4 ms·
> However, once you're out of the unrealistic scenarios (single query benchmarks, etc.), it doesn't do that well[1]. I'm curious about the result since it didn
by sirn 10y ago
> However, once you're out of the unrealistic scenarios (single query benchmarks, etc.), it doesn't do that well[1].
I'm curious about the result since it didn't matched my experience. So I proceed to take a look at the source code for both Pyramid's[1] and Django's[2] benchmarks. From the look of it, I feel like there are too much difference in implementation to call this a realistic comparison.
From a quick glance, Django's benchmark seems to contain a little bit of micro-optimization and is rendering JSON response directly with uJSON[3] (which looks to be a lot faster than native JSON module)[4], while Pyramid's benchmark did not seems to go through any optimizations and is returning a list of SQLAlchemy objects that get passed into a custom renderer[5]¹ and render using native JSON module.
So I don't think it's entirely fair to say Pyramid is slow in a real world scenario based on this benchmark alone.
[1]: https://github.com/TechEmpower/FrameworkBenchmarks/blob/c8a551c4aec625d0d377b77e70eebb8da48290cd/frameworks/Python/pyramid/frameworkbenchmarks/views.py#L30-L49 https://github.com/TechEmpower/FrameworkBenchmarks/blob/c8a5...
[2]: https://github.com/TechEmpower/FrameworkBenchmarks/blob/c8a551c4aec625d0d377b77e70eebb8da48290cd/frameworks/Python/django/hello/world/views.py#L42-L61 https://github.com/TechEmpower/FrameworkBenchmarks/blob/c8a5...
[3]: https://pypi.python.org/pypi/ujson https://pypi.python.org/pypi/ujson
[4]: http://artem.krylysov.com/blog/2015/09/29/benchmark-python-json-libraries/ http://artem.krylysov.com/blog/2015/09/29/benchmark-python-j...
[5]: https://github.com/TechEmpower/FrameworkBenchmarks/blob/c8a551c4aec625d0d377b77e70eebb8da48290cd/frameworks/Python/pyramid/frameworkbenchmarks/models.py#L37-L48 https://github.com/TechEmpower/FrameworkBenchmarks/blob/c8a5...
¹ Using pyramid.renderers.JSON here probably make more sense, but to match Django's implementation, one can wrap a serialized JSON into `Response` object.