Skip to content

Commit a605b93

Browse files
committed
Improve benchmarks
1 parent 9f04f37 commit a605b93

File tree

5 files changed

+108
-2067
lines changed

5 files changed

+108
-2067
lines changed

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ rustyline = "6.0"
4646
cpython = "0.5.0"
4747
criterion = "0.3"
4848

49-
[[bench]]
50-
name = "parsing"
51-
harness = false
52-
5349
[[bench]]
5450
name = "execution"
5551
harness = false

benches/README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,27 @@ These are some files to determine performance of rustpython.
44

55
## Usage
66

7-
Install pytest and pytest-benchmark:
7+
Running `cargo bench` from the root of the repository will start the benchmarks. Once done there will be a graphical
8+
report under `target/critierion/report/index.html` that you can use use to view the results.
89

9-
$ pip install pytest-benchmark
10+
To view Python tracebacks during benchmarks, run `RUST_BACKTRACE=1 cargo bench`. You can also bench against a
11+
specific installed Python version by running:
1012

11-
Then run:
13+
```shell
14+
$ PYTHON_SYS_EXECUTABLE=python3.7 cargo bench
15+
```
1216

13-
$ pytest
17+
### Adding a benchmark
1418

15-
You can also benchmark the Rust benchmarks by just running
16-
`cargo bench` from the root of the repository. To view Python tracebacks during benchmarks,
17-
run `RUST_BACKTRACE=1 cargo bench`.
19+
Simply adding a file to the `benchmarks/` directory will add it to the set of files benchmarked. Each file is tested
20+
in two ways:
1821

19-
You can bench against a specific Python version by running:
22+
1. The time to parse the file to AST
23+
2. The time it takes to execute the file
2024

21-
```shell
22-
$ PYTHON_SYS_EXECUTABLE=python3.7 cargo bench
23-
```
25+
## MacOS setup
2426

25-
On MacOS you will need to
26-
add the following to a `.cargo/config` file:
27+
On MacOS you will need to add the following to a `.cargo/config` file:
2728

2829
```toml
2930
[target.x86_64-apple-darwin]

0 commit comments

Comments
 (0)