GithubHelp home page GithubHelp logo

pyspeed's Introduction

Python Speedups

Investigating and comparing Python's performance speedup alternatives

Overview

Note: values may change - local setup was experimental and unstable.

method time relative
python 3.9 126.06s 1
python 3.11 117.97s 0.93
pypy3 3.51s 0.028
cython 121.45s 0.96
mypyc 106.56s 0.85
pyo3 4.59s 0.036
mojo* ??? ???

Setup

git clone ...
pdm install

Python 3.9

source .venv/bin/activate
python -c "from pure_python.triangles import main; main()"

Python 3.11

pdm venv create -n py311 python3.11
eval $(pdm venv activate py311)
python -c "from pure_python.triangles import main; main()"

Cython

source .venv/bin/activate
cythonize --3str -i pure_python/triangles.py
python -c "from pure_python.triangles import main; main()"
rm pure_python/*.so pure_python/*.c # clean up
rm -rf pure_python/build  # clean up

Mypyc

source .venv/bin/activate
mypyc pure_python/triangles.py
python -c "from triangles import main; main()"
rm *.so  # clean up
rm -rf build/  # clean up

PyO3

source .venv/bin/activate
cd rust_python/
maturin develop --release
python -c "from rust_python.triangles import main; main();"

Mojo ๐Ÿ”ฅ

Mojo not open source yet (June, 2023). Could not compare performance to regular Python - imports, different syntax, etc.

pyspeed's People

Contributors

murilo-cunha avatar

Watchers

 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.