Git Product home page Git Product logo

python311benchmark's Introduction

Django 4.2 + Python 3.11 benchmark

The main goal here is to measure how Python 3.11 internal speedups affect web frameworks performance. Here we compare Django 4.2 performance on Python 3.10.7 vs Python 3.11.0.

All tests were done on Macbook M1. Steps to reproduce are at the end of the page.

TLDR: it's faster on Python 3.11.

Positive highlights

Which cases are way faster now:

Name Difference
query_update 4.2677x faster
query_delete_related 3.8393x faster
query_count 3.6758x faster
url_reverse 2.0484x faster
query_dates 1.6432x faster
query_exists 1.6107x faster
query_delete 1.5411x faster
query_latest 1.5172x faster
url_resolve_nested 1.5135x faster
template_compilation 1.4355x faster

Negative highlights

Which cases are slower now:

Name Difference
raw_sql 2.7545x slower
query_values 1.6635x slower
query_aggregate 1.5818x slower
query_iterator 1.2973x slower
query_in_bulk 1.2651x slower
query_complex_filter 1.2029x slower

Conclusion

Almost all test points are faster based on avg data from 50 runs.

Raw results are available here in the static folder.

How to reproduce

Here are steps to reproduce the results on your local machine. No need to clone this repo, just follow the commands. Standard Django util is used: https://github.com/django/djangobench.

Set up both 3.10 and 3.11 virtual envs. Installing benchmark util and Django in both envs.

cd ~/Developer
mkdir benchmarks
cd benchmarks

python3.10 -m venv .venv310
source .venv310/bin/activate

pip install -e git+https://github.com/django/djangobench.git#egg=djangobench
pip install django pytz

deactivate

python3.11 -m venv .venv311
source .venv311/bin/activate

pip install -e git+https://github.com/django/djangobench.git#egg=djangobench
pip install django pytz

git clone https://github.com/django/django.git
cd django

Run comparison 3.10 and 3.11 for the most recent Django version (4.2):

djangobench --vcs=none --control=. --experiment=. \
    --control-python=~/Developer/benchmarks/.venv310/bin/python \
    --experiment-python=~/Developer/benchmarks/.venv311/bin/python

python311benchmark's People

Contributors

d3quone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.