Comments (5)
I've written a new dispatcher from scratch that is compatible with the current one (all the tests are passing) but is more optimized. It uses a cached dispatch tree instead of making system calls for every request.
from aspen.py.
The new dispatcher is one order of magnitude faster than the old one. However I only measured the dispatching itself, whereas the percentages I mentioned in my first comment were for the entire request processing by Aspen+Pando.
from aspen.py.
Observation of response times in HTTP logs suggests that when running on AWS with Apache's (Update: Apache handles some requests itself, that's why they're 10x faster.) When running locally on my laptop with gunicorn the overhead of the dispatcher seems to be less than 20%.mod_wsgi
the requests going through the dispatcher are more than 10 times slower than the requests that bypass it.
The performance gain from optimizing the dispatcher will probably be closer to 10% than to 90%, but in any case it seems worth doing.
from aspen.py.
The performance gain from optimizing the dispatcher will probably be closer to 10% than to 90%, but in any case it seems worth doing.
I don't have a good link but iinm core Python's threshold for optimization is 10%: if it's not at least 10% faster then it's not worth the additional complexity.
from aspen.py.
A profiling of Liberapay's code shows that the overhead of the old dispatcher is less than 2% when serving a dynamic page, but almost 22% when serving a small static file, so the new dispatcher should improve Aspen's performance by at least 20%.
from aspen.py.
Related Issues (20)
- Efficient file transfer isn't implemented HOT 1
- Configuration is still taken from the environment
- Pure-python alternative to simplates HOT 18
- No easy way to pass the output of a single simplate page through a filter
- Static resources are always cached in RAM
- Unexpected `output` in template HOT 7
- Repoint aspen.io to RtD HOT 5
- Broken test HOT 3
- What about a rc3 release to PyPI to finalize support for Python 3? HOT 3
- The dispatcher should not raise redirects
- Static.render doesn't check the request method HOT 2
- The syntax of path variables is ambiguous HOT 4
- Drop state chain? HOT 3
- Simplates are assumed to be ASCII even under python 3
- The number of system calls made by dispatchers could be reduced
- 3.9 dropped support for Aspen "magic directories" HOT 1
- Keeping static files open
- `mmap` for static files
- Compression of static files
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aspen.py.