GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - yanto77/cpp-python-binding-benchmark: A project to measure overhead of Python bindings for C++ codebase

BranchesTags
Open more actions menu

Latest commit

 

History

1 Commit
1 Commit

Folders and files

NameName
Last commit message
Last commit date
notes/results
notes/results
 
 
src
src
 
 
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
CMakeLists.txt
CMakeLists.txt
 
 
LICENSE.md
LICENSE.md
 
 
README.md
README.md
 
 
benchmark.sh
benchmark.sh
 
 
build.sh
build.sh
 
 
collect_and_plot.py
collect_and_plot.py
 
 

Repository files navigation

Benchmark of Python-C++ bindings

A project to measure overhead of Python bindings for C++ codebase, using simple test scenarios -- generation of Mandelbrot set image and simulation of Conway’s Game Of Life. Tested modules include: CPython API, cppyy, Cython, CFFI, pybind11, nanobind, SWIG.

Write-up and results: https://yanto.fi/2022/09/benchmark-of-python-c-bindings/

Installation

These instructions were tested on Ubuntu 22.04.

Install pre-requisites:

# System dependencies
$ sudo apt install python3.10-dev pypy3
$ python3 -m pip install cppyy cffi Cython swig
$ pypy3 -m pip install cppyy cffi Cython

# Submodule dependencies
$ git submodule update --init --recursive

# Optional dependencies for generating result plots
$ sudo apt install python3-pip python3-tk
$ pip3 install matplotlib

To run the benchmark:

# Runs cmake to create a clean build
$ ./build.sh

# Runs through each available/configured test
$ ./benchmark.sh
mandelbrot, single, cpp, 0.345 sec
mandelbrot, simple, cpp, 0.351 sec
mandelbrot, complex, cpp, 0.329 sec
mandelbrot, single, cpy_cython, 0.396 sec
mandelbrot, simple, cpy_cython, 0.748 sec
mandelbrot, complex, cpy_cython, 0.973 sec
...

To generate plots:

# Do a clean build and run ./becnhmark.sh multiple times
python3 ./collect_and_plot.py

To debug python, install and use /usr/bin/python3.10-dgb as the interpreter.

$ sudo apt install python3.10-dbg

License

This project is licensed under the the MIT license - see the LICENSE.md file for details.

About

A project to measure overhead of Python bindings for C++ codebase

Resources

Readme
MIT license
Activity

Stars

1 star

Watchers

1 watching

Forks

0 forks
Report repository

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.