5 ms·
He's missing Cython, which is another good option when you're looking for speed. My personal favourite optimisation, from needing to shave a few milliseconds o
by vosper 11y ago
He's missing Cython, which is another good option when you're looking for speed.
My personal favourite optimisation, from needing to shave a few milliseconds off our API response times, was discovering that it's measurably slower to use * args and * *kwargs, and switching to explicitly declaring and passing arguments in the relevant parts of the code.
We also did a few other neat things:
- Rolled our own UUID-like generator in pure Python (I was surprised this helped, but the profiler doesn't lie)
- Switched to working directly with WebOb Request and Response objects rather than using a framework
- Used a background thread with a single slot queue to make sure our response was returned to the user before we emitted the event log message, but always emit the message before moving to the next request
- Heavy optimisation of memcache / redis reads and writes
Edit: Fixed formatting
- jMyles 11y ago- Used a background thread with a single slot queue to make sure our response was returned to the user before we emitted the event log message, but always emit the message before moving to the next request The crosstown_traffic API in hendrix does exactly this. https://github.com/hangarunderground/hendrix https://github.com/hangarunderground/hendrix