httpie-cli/extras/profiling/README.md

33 lines
1.4 KiB
Markdown
Raw Normal View History

# HTTPie Benchmarking Infrastructure
2022-01-24 16:03:41 +01:00
This directory includes the benchmarks we use for testing HTTPie's speed and the infrastructure to automate this testing accross versions.
2022-01-24 16:04:30 +01:00
2022-01-24 16:05:49 +01:00
## Usage
2022-01-24 16:11:09 +01:00
Ensure the following requirements are satisfied:
2022-01-24 16:05:49 +01:00
- Python 3.7+
- `pyperf`
2022-01-24 16:04:30 +01:00
2022-01-24 16:11:09 +01:00
Then, run the `extras/benchmarks/run.py`:
2022-01-24 16:11:09 +01:00
```
$ python extras/profiling/run.py
```
Without any options, this command will initially create an isolated environment and install `httpie` from the latest commit. Then it will create a
second environment with the `master` of the current repository and run the benchmarks on both of them. It will compare the results and print it as a
markdown table:
2022-01-24 16:11:09 +01:00
| Benchmark | master | this_branch |
| -------------------------------------- | :----: | :------------------: |
2022-01-24 16:11:09 +01:00
| `http --version` (startup) | 201 ms | 174 ms: 1.16x faster |
| `http --offline pie.dev/get` (startup) | 200 ms | 174 ms: 1.15x faster |
| Geometric mean | (ref) | 1.10x faster |
If your `master` branch is not up-to-date, you can get a fresh clone by passing `--fresh` option. This way, the benchmark runner will clone the
`httpie/httpie` repo from `GitHub` and use it as the baseline.
2022-01-24 16:11:09 +01:00
You can customize these branches by passing `--local-repo`/`--target-branch`, and customize the repos by passing `--local-repo`/`--target-repo` (can
either take a URL or a path).