openai / gym-http-api

API to access OpenAI Gym from other languages via HTTP
MIT License
293 stars 142 forks source link

don't prettify JSON #49

Closed unixpickle closed 7 years ago

unixpickle commented 7 years ago

jsonify() runs significantly faster when it does not have to prettify, especially in Python 3.6. This is important for environments like Pong-v0, where jsonify() can be a significant bottleneck.

Here are some performance comparisons when I capture 6 frames from Pong-v0:

Python Version Pretty Not pretty
Python 3.6 2.8s 1.3s
Python 2.7 3.6s 2.8s

Reference: http://stackoverflow.com/questions/37931927/why-is-flasks-jsonify-method-slow