Skip to content

Commit c9a332c

Browse files
authored
Merge pull request RustPython#2367 from orf/criterion
Refactor benchmarking suite to use Criterion and add microbenchmarks
2 parents 7681892 + b221dbb commit c9a332c

30 files changed

+680
-2181
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ jobs:
160160
- name: install flake8
161161
run: python -m pip install flake8
162162
- name: run lint
163-
run: flake8 . --count --exclude=./.*,./Lib,./vm/Lib --select=E9,F63,F7,F82 --show-source --statistics
163+
run: flake8 . --count --exclude=./.*,./Lib,./vm/Lib,./benches/ --select=E9,F63,F7,F82 --show-source --statistics
164164
miri:
165165
name: Run tests under miri
166166
runs-on: ubuntu-latest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ flame.txt
1616
flamescope.json
1717
/wapm.lock
1818
/wapm_packages
19+
/.cargo/config

Cargo.lock

Lines changed: 185 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ members = [
1414
"derive", "jit", "parser", "vm", "vm/pylib-crate", "wasm/lib",
1515
]
1616

17-
[[bench]]
18-
name = "bench"
19-
path = "./benchmarks/bench.rs"
20-
2117
[features]
2218
default = ["threading", "pylib"]
2319
flame-it = ["rustpython-vm/flame-it", "flame", "flamescope"]
@@ -48,6 +44,15 @@ rustyline = "6.0"
4844

4945
[dev-dependencies]
5046
cpython = "0.5.0"
47+
criterion = "0.3"
48+
49+
[[bench]]
50+
name = "execution"
51+
harness = false
52+
53+
[[bench]]
54+
name = "microbenchmarks"
55+
harness = false
5156

5257
[[bin]]
5358
name = "rustpython"
@@ -56,10 +61,16 @@ path = "src/main.rs"
5661
[profile.dev.package."*"]
5762
opt-level = 3
5863

64+
[profile.bench]
65+
lto = true
66+
codegen-units = 1
67+
opt-level = 3
68+
5969
[patch.crates-io]
6070
# REDOX START, Uncommment when you want to compile/check with redoxer
6171
# # following patches are just waiting on a new version to be released to crates.io
6272
# nix = { git = "https://github.com/nix-rust/nix" }
6373
# crossbeam-utils = { git = "https://github.com/crossbeam-rs/crossbeam" }
6474
# socket2 = { git = "https://github.com/alexcrichton/socket2-rs" }
6575
# REDOX END
76+

0 commit comments

Comments
 (0)