httpie-cli/extras/profiling/README.md

40 lines
1.5 KiB
Markdown
Raw Normal View History

# HTTPie Benchmarking Infrastructure
2022-01-24 16:03:41 +01:00
2022-01-24 16:20:03 +01:00
This directory includes the benchmarks we use for testing HTTPie's speed and the
infrastructure to automate this testing across 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
Then, run the `extras/profiling/run.py`:
2022-01-24 16:16:38 +01:00
```console
2022-01-24 16:11:09 +01:00
$ python extras/profiling/run.py
```
2022-01-24 16:20:03 +01:00
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 |
2022-01-24 16:20:03 +01:00
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/cli`
2022-01-24 16:20:03 +01:00
repo from `GitHub` and use it as the baseline.
2022-01-24 16:11:09 +01:00
2022-01-24 16:20:03 +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).
2022-01-24 16:14:57 +01:00
If you want to run a third environment with additional dependencies (such as
2022-01-24 16:20:03 +01:00
`pyOpenSSL`), you can pass `--complex`.