Coder Social home page Coder Social logo

Comments (5)

Changaco avatar Changaco commented on July 17, 2024 1

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.

Changaco avatar Changaco commented on July 17, 2024 1

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.

Changaco avatar Changaco commented on July 17, 2024

Observation of response times in HTTP logs suggests that when running on AWS with Apache's mod_wsgi the requests going through the dispatcher are more than 10 times slower than the requests that bypass it. (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%.

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.

chadwhitacre avatar chadwhitacre commented on July 17, 2024

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.

Changaco avatar Changaco commented on July 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.