GithubHelp home page GithubHelp logo

yapyjit's Introduction

Yet Another PYthon JIT

Still under early development. Check support for python syntax at supp_tab.tsv.

Design considerations

  1. It shall be suitable for use with all major python versions (3.8, 3.9, 3.10).
  2. It shall support all valid python, and does not need to infer all static types as in numba.
  3. JIT should be fast, unlike numba or oher LLVM-based JIT's.
  4. In most cases yapyjit shall be a plug-and-enable library to speed up python execution. It is a library so all CPython extensions are inherently compatible, unlike PyPy.

Benchmarks

The benchmarks are from python/pyperformance. More optimizations would be implemented in the compiler, and thus the results are subject to change.

Surprisingly, only with very basic transpiling from python code to machine code (that calls relevant CPython functions), as well as a bit of inline caching of dynamic calls in python, it already shows a significant amount of speed-up. yapyjit is even faster than PyPy on several tasks.

On Intel Core i7-4700MQ (benchmarks are listed in alphabetical order, time is in milliseconds):

Benchmark CPython38 CPy38 + yapyjit Speed-up (100% → x%)
float 254 ± 16 181 ± 13 71.26%
mdp (*) 5950 ± 410 5670 ± 290 95.29%
nbody 371 ± 69 243 ± 39 65.50%
scimark_fft 921 ± 100 575 ± 100 62.43%
scimark_monte_carlo 278 ± 48 211 ± 43 75.90%
scimark_sor 506 ± 60 444 ± 59 87.75%
scimark_sparse_mat_mult 13 ± 2 6.8 ± 2 52.31%
spectral_norm 376 ± 61 196 ± 24 52.12%

(*): yapyjit cannot fully compile yet, various parts are still interpreted.

Installation

Prebuilt wheels

Prebuilt wheels for x64 windows, linux and Mac OS can be downloaded from github actions artifacts.

Development/Build from source

  1. Ensure that you have correctly set up for building native CPython extensions.
  2. Clone this repository, and run
python setup.py bdist_wheel
  1. Install the wheel in the dist folder.

Usage

Just import yapyjit and use @yapyjit.jit to decorate functions you'd like to JIT. The syntax also supports member functions, class methods and static methods. Notice that it is still in an early stage of development. If unsupported python syntax is found an error will be raised. Also expect other bugs in the compiler. You are welcome to open an issue if you find one.

yapyjit's People

Contributors

eliphatfs avatar

Watchers

James Cloos 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.