Coder Social home page Coder Social logo

pyhttp-benchmark's Introduction

pyhttp-benchmark

Micro-benchmarks of the Python HTTP clients. Heavily inspired by httpxprof.

Each test runs inside a new spawn process with garbage collector stopped. Use time.perf_counter() and time.process_time().

See:

The HTTPS server uses:

Usage

In a virtualenv:

# install
pip install -e git+https://github.com/dalf/pyhttp-benchmark#egg=pyhttpbenchmark

# or if you want to use --png option (see below), add the graph extra:
# pip install -e git+https://github.com/dalf/pyhttp-benchmark#egg=pyhttpbenchmark[graph]

# install shell completion
eval "$(_PYHTTPBENCHMARK_COMPLETE=source_bash pyhttpbenchmark )"

# run all cases, all scenarios
# output in the current directory
# it can be changed with the --output parameter
pyhttpbenchmark run . .

See the output.

# display available cases and scenarios
pyhttpbenchmark show cases
pyhttpbenchmark show scenarios

# run some cases and some scenarios
pyhttpbenchmark run httpx_uvloop s100_1_0,p60_1024_5

# run one case with one scenario
# record .prof, .csv files and create graph store as .png file (require matplotlib)
pyhttpbenchmark run --png --csv --profile httpcore_uvloop s100_1_0

# view .prof file using snakeviz
pyhttpbenchmark view httpcore_uvloop_anyio_http2 s100_1_0

# custom cases
wget https://gist.githubusercontent.com/dalf/cebb2032578151357b8c9ab2a320b51f/raw/dab40e925ced12738cc6f69c61b43a2d20f0c509/httpx_trio.py
wget https://gist.githubusercontent.com/dalf/cebb2032578151357b8c9ab2a320b51f/raw/7dbc414f53034d256f8063fc9da21dc94eefb65f/httpx_hack.py
cat httpx_trio.py
cat httpx_hack.py
pyhttpbenchmark run --tries 4 --profile ./httpx_trio.py,./httpx_hack.py,httpx,aiohttp 1_100seq_1mb
pyhttpbenchmark view ./httpx_hack.py 1_100seq_1mb

pyhttp-benchmark's People

Contributors

dalf avatar florimondmanca avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

florimondmanca

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.