Skip to content
Nitrous: a dynamic program reoptimizer
C++ C Python Makefile CMake
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

Nitrous

A JIT plug-in for dynamic systems

Nitrous is a JIT that is designed to be added to existing programs. It has a number of features for understanding and reasoning about existing codebases in order to speed them up. There are currently three main components:

  • A tracing interpreter that is able to see and understand the program's execution
  • A "fact" system where the program author can teach the JIT facts about the program. A fact may be something like "objects of this type are immutable", or "this function produces objects of a certain type", which recursively may imply other facts.
  • A speculation system that allows the author to speculate on new facts being true. If the speculations fail the program will be deoptimized and fall back to a base implementation

The result is a powerful system for reasoning about the behavior of existing codebases and dynamically using this information to optimize execution.

Pystol

Nitrous's main use case right now is Pystol, its application to the CPython codebase. Pystol teaches Nitrous about the facts of the CPython codebase, as well as what speculations are profitable.

For example, Pystol knows that PyTuple_New produces immutable tuples. Then Nitrous's tracing interpreter is able to see that argument tuples are created and then immediately unpacked and otherwise unused. Pystol can then know that the tuple is unused and its creation can be elided, greatly speeding up function call performance completely as a compiler optimization.

Code layout

src/ contains the main source code for Nitrous python/ contains Pystol, including a modified CPython (python/cpython), the Pystol code (python/pystol), and some runtime support libraries (python/nitrous).

Run make bm_nbody to build all the code and run a Python benchmark.

The build process will build a fresh version of clang, so be prepared for it to take a while.

You can’t perform that action at this time.