Skip to content

Testing the performance impact of using native libraries in Python programs.

License

Notifications You must be signed in to change notification settings

JoelEager/PythonInteropBenchmarking

Repository files navigation

Python Interoperability Benchmarking

Tests the performance impact of using native libraries to replace CPU-intensive parts of Python programs. (A follow-up to my previous project on benchmarking programming languages.)

For the F# implementation I used pythonnet which provides an interoperability layer bridging .NET and the CPython interpreter.

Setup

The Python code requires CPython 3.5 or newer and the PyPI packages in requirements.txt.

The F# code requires .NET Framework 4.8.

Once both are installed, build the F# library. After that you should be good to run any of the scripts listed below.

Usage

Run the benchmark

python3 main.py [iterations] [implementation]

(Where implementation is python or fsharp.)

Run the implementation tests

python3 test.py

Run the .NET interop tests

python3 fsharp_implementation.py

Results

These results where collected on a desktop with an AMD Ryzen 5 2600X using 50,000 iterations.

Python: 72.1551 seconds

F#: 61.6405 seconds

About

Testing the performance impact of using native libraries in Python programs.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published