Skip to content

Simple testing stand for comparing the performance of servers implemented in Cython, C++, and Python.

Notifications You must be signed in to change notification settings

peplxx/Fastapi-vs-httplib.h

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastApi vs httplib.h

Python FastAPI С C++ httplib.h License

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.

Configurations

  • C++ Server: Using httplib.h (a single-header HTTP library for C++).
  • Python Server: Using FastAPI and Uvicorn.
  • Cython Server: The same Python server compiled into a Cython module for performance comparison.

Note: All servers are configured to work on port 8080.

Requirements

  • Make
  • Python 3.12+
  • C++ compiler with C++17 support
  • httplib.h header in cpp-server dir
  • 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-dev

Navigation

Commands

To navigate in avalable commands in project you can use the following command:

make help

It will print all available commands in the project and their description

Structure

  • cpp-server/ - Container all source files of C++ server
  • ctyhon-server/ - Container all source files and build configuration for cython server
  • python-server/ - Container all source files of Python server

Usage / How to run servers

  • make cy-serve: Build and run Cython server
  • make cpp-serve: Build and run C++ server
  • make py-run: Run Python server

Benchmark

TODO: 📝 Add benchmark

About

Simple testing stand for comparing the performance of servers implemented in Cython, C++, and Python.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published