Coder Social home page Coder Social logo

mikewlange / pyston Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pyston/pyston

0.0 1.0 0.0 320.95 MB

A faster and highly-compatible implementation of the Python programming language.

Home Page: https://www.pyston.org/

License: Other

Shell 0.18% C 34.86% C++ 1.28% DTrace 0.01% Python 62.24% Batchfile 0.15% HTML 0.39% CSS 0.01% Roff 0.08% VBScript 0.01% PLSQL 0.05% XSLT 0.01% PowerShell 0.04% Rich Text Format 0.02% Objective-C 0.06% Makefile 0.14% Assembly 0.10% Common Lisp 0.05% M4 0.36% CMake 0.01%

pyston's Introduction

Pyston

Pyston is a fork of CPython 3.8.8 with additional optimizations for performance. It is targeted at large real-world applications such as web serving, delivering up to a 30% speedup with no development work required.

Blog

Website

Mailing list

Discord

Techniques

We plan on explaining our techniques in more detail in future blog posts, but the main ones we use are:

  • A very-low-overhead JIT using DynASM
  • Quickening
  • Aggressive attribute caching
  • General CPython optimizations
  • Build process improvements

Docker images

We have some experimental docker images on DockerHub with Pyston pre-installed, you can quickly try out Pyston by doing

docker run -it pyston/pyston

You could also attempt to use this as your base image, and python will be provided by Pyston.

The default image contains quite a few libraries for compiling extension modules, and if you'd like a smaller image we also have a pyston/slim version that you can use.

These have not been heavily tested, so if you run into any issues please report them to our tracker.

Checking for Pyston at runtime

Our current recommended way to see if your Python code is running on Pyston is to do hasattr(sys, "pyston_version_info").

Installing packages

Pyston is API compatible but not ABI compatible with CPython. This means that C extensions will work, but they need to be recompiled.

Typically with Python one will download and install pre-compiled packages, but with Pyston there are currently not pre-compiled packages available (we're working on that) so the compilation step will run when you install them. This means that you may run into problems installing packages on Pyston when they work on CPython: the same issues you would have trying to recompile these packages for CPython.

Many packages have build-time dependencies that you will need to install to get them to work. For example to pip install cryptography you need a Rust compiler, such as by doing sudo apt-get install rustc.

Building Pyston

Build dependencies

First do

git submodule update --init pyston/llvm pyston/bolt pyston/LuaJIT pyston/macrobenchmarks

Pyston has the following build dependencies:

sudo apt-get install build-essential git cmake clang libssl-dev libsqlite3-dev luajit python3.8 zlib1g-dev virtualenv libjpeg-dev linux-tools-common linux-tools-generic linux-tools-`uname -r`

Extra dependencies for running the test suite:

sudo apt-get install libwebp-dev libjpeg-dev python3.8-gdbm python3.8-tk python3.8-dev tk-dev libgdbm-dev libgdbm-compat-dev liblzma-dev libbz2-dev nginx rustc time

Extra dependencies for producing Pyston debian packages and portable directory release:

sudo apt-get install dh-make dh-exec debhelper patchelf

Building

For a build with all optimizations enabled (LTO+PGO) run:

make -j`nproc`

An initial build will take quite a long time due to having to build LLVM twice, and subsequent builds are faster but still slow due to extra profiling steps.

A symlink to the final binary will be created with the name pyston3

For a quicker build during development run:

make unopt -j`nproc`

the generated executable can be found inside build/unopt_install/

Running a python file called script.py with pyston can be easily done via:

make script_unopt

or

make script_opt

pyston's People

Contributors

gvanrossum avatar benjaminp avatar birkenfeld avatar freddrake avatar rhettinger avatar vstinner avatar serhiy-storchaka avatar pitrou avatar jackjansen avatar loewis avatar tim-one avatar akuchling avatar brettcannon avatar bitdancer avatar warsaw avatar ezio-melotti avatar mdickinson avatar nnorwitz avatar miss-islington avatar tiran avatar terryjreedy avatar orsenthil avatar gpshead avatar vsajip avatar merwok avatar jeremyhylton avatar 1st1 avatar berkerpeksag avatar ned-deily avatar gward avatar

Watchers

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