This repository provides a simple testing stand for comparing the performance of servers implemented in Cython, C++, and Python. It also serves as an example of how to compile a Python application as a Cython module.
- C++ Server: Using
httplib.h(a single-header HTTP library for C++). - Python Server: Using
FastAPIandUvicorn. - Cython Server: The same Python server compiled into a Cython module for performance comparison.
Note: All servers are configured to work on port 8080.
- Make
- Python 3.12+
- C++ compiler with C++17 support
- httplib.h header in
cpp-serverdir - Python3.12-dev for Cython, e.g. install via ppa
- Uv for Python dependencies
Install httplib.h:
cd cpp-server
# Using curl
curl -L -o httplib.h https://github.com/yhirose/cpp-httplib/releases/download/0.7.13/httplib.h
# Or using wget
wget https://github.com/yhirose/cpp-httplib/releases/download/0.7.13/httplib.h -O httplib.h
Install python-dev package
sudo apt-get install python3.12-devTo navigate in avalable commands in project you can use the following command:
make helpIt will print all available commands in the project and their description
cpp-server/- Container all source files of C++ serverctyhon-server/- Container all source files and build configuration for cython serverpython-server/- Container all source files of Python server
make cy-serve: Build and run Cython servermake cpp-serve: Build and run C++ servermake py-run: Run Python server
TODO: 📝 Add benchmark