The idea is to take the Django package as it is, identify a couple of
computationally intensive modules in it, compile them to binary extension
modules with Cython, package the result as a binary wheel, and upload it
to PyPI, next to the regular Python wheel, so that supported platforms can
pick it up instead of the plain Python wheel. Note that this is completely
optional since the binary wheels would behave just like the Python wheel,
except for being faster.
Alex Orlov from Instagram tried this with the Django URL routing module
back in 2017 and found a massive speedup, as he reported in his `PyCon-US`
2017 talk.
Even without any further manual optimisation, Cython compilation usually
leads to a speedup of 10-30%, which translates to a substantial amount of
time, energy and CO2-emissions saved on user side.
--
Ticket URL: <https://code.djangoproject.com/ticket/34755>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => wontfix
Comment:
Hello Stefan, thank you for your interest in making Django better!
There are many challenges related to this proposal that would need
discussing with the community as a whole (considering Django is a
community driven project). Specifically, the release process would
considerably grow in complexity and that would require more
resources/procedures/people/time.
For cases like this, the recommended path forward is to first propose and
discuss the idea/request with the community and gain consensus. To do
that, please start a new conversation on the
[https://forum.djangoproject.com/c/internals/5 Django Forum], where you'll
reach a wider audience and likely get richer feedback.
I'll close the ticket following the
[https://docs.djangoproject.com/en/4.2/internals/contributing/triaging-
tickets/#closing-tickets triage guide], but if there is a community
agreement for the proposal, you are welcomed to come back to the ticket
and point to the forum topic, so we can then re-open it. For more details,
please see
[https://docs.djangoproject.com/en/stable/internals/contributing/bugs-and-
features/#requesting-features the documented guidelines for requesting
features].
Thanks!
--
Ticket URL: <https://code.djangoproject.com/ticket/34755#comment:1>
Comment (by Adam Johnson):
There have been a couple of threads in the past about compiling with
Cython, worth checking out: https://groups.google.com/g/django-
developers/search?q=cython
I was involved in one effort compiling the templates module, it provided a
benchmarked improvement but we couldn't spot it in our production graphs
when deployed 🤷♂️.
--
Ticket URL: <https://code.djangoproject.com/ticket/34755#comment:2>