2022-01-24 16:03:08 +01:00
|
|
|
# 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
|
2022-04-16 01:06:34 +02:00
|
|
|
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:14:40 +01:00
|
|
|
|
2022-01-24 16:05:49 +01:00
|
|
|
- Python 3.7+
|
|
|
|
- `pyperf`
|
2022-01-24 16:04:30 +01:00
|
|
|
|
2022-06-19 09:20:22 +02:00
|
|
|
Then, run the `extras/profiling/run.py`:
|
2022-01-24 16:14:40 +01:00
|
|
|
|
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
|
|
|
|
2022-01-24 16:14:40 +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 |
|
2022-01-24 16:14:40 +01:00
|
|
|
| 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
|
2023-08-06 14:04:32 +02:00
|
|
|
`--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
|
|
|
|
2022-04-16 01:06:34 +02: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`.
|