blaze is a rust-Python module to make your Python codes blazingly-fast.
This module was written in order to extend Python codes to use the performance of low-level languages with zero complexity. blaze, in essence, allows Python developers to tap into the performance of rust language by interfacing between the two languages.
For specific code details, please see developer documentation.
Compared to native Python methods, blaze outperforms by at least ~50%.
Test | Python | Blaze |
---|---|---|
.count() | ||
.replace() (replace) | ||
.replace() (regex) | ||
.to_lower() | ||
.to_upper() |
There is only cargo dependency to compile the rust code into a Python module.
~$ sudo apt install cargo
By default, blaze is built for Python 2.7 support. However, in order to build for Python 3+, please edit Cargo.toml and run make
.
~$ make
~$ # make release
Running benchmarks and tests will require some pip packages.
~$ pip install pytest pytest-benchmark
~$ make test
It is very straightforward to use blaze. When build is completed, a binary called "blaze.so" will be generated at the project base. From there, in your Python code, just use the import
keyword:
import blaze # imports "blaze.so"
To prevent tainting your local environment, it is recommended to build using docker. Use one of the make commands below and you'll see a link to https://file.io at the end of docker log.
~$ make docker-ubuntu # ubuntu
~$ make docker-centos # centos
blaze is under MIT License.