Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit d2a09b5

Browse files
authored
Merge pull request #190 from gnzlbg/libm_bench
Move benchmarks into its own crate
2 parents 04a276f + ab7089b commit d2a09b5

File tree

6 files changed

+30
-13
lines changed

6 files changed

+30
-13
lines changed

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@ checked = []
2626
[workspace]
2727
members = [
2828
"crates/compiler-builtins-smoke-test",
29+
"crates/libm-bench",
2930
]
3031

3132
[dev-dependencies]
3233
no-panic = "0.1.8"
33-
rand = "0.6.5"
34-
paste = "0.1.5"
3534

3635
[build-dependencies]
3736
rand = { version = "0.6.5", optional = true }

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ The API documentation can be found [here](https://docs.rs/libm).
3939

4040
## Benchmark
4141
[benchmark]: #benchmark
42-
Run `cargo +nightly bench`
4342

44-
NOTE: remember to have nightly installed `rustup install nightly`
43+
The benchmarks are located in `crates/libm-bench` and require a nightly Rust toolchain.
44+
To run all benchmarks:
45+
46+
> cargo +nightly bench --all
4547
4648
## Contributing
4749

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
vmImage: ubuntu-16.04
7878
steps:
7979
- template: ci/azure-install-rust.yml
80-
- bash: cargo bench
80+
- bash: cargo bench --all
8181
displayName: "Benchmarks"
8282
variables:
8383
TOOLCHAIN: nightly

ci/run.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
#!/bin/sh
1+
#!/usr/bin/env sh
22

33
set -ex
44
TARGET=$1
55

6-
cargo test --target $TARGET
7-
cargo test --target $TARGET --release
6+
CMD="cargo test --all --no-default-features --target $TARGET"
87

9-
cargo test --features 'checked musl-reference-tests' --target $TARGET
8+
$CMD
9+
$CMD --release
1010

11-
cargo test --features 'checked musl-reference-tests' --target $TARGET --release
11+
$CMD --features 'stable'
12+
$CMD --release --features 'stable'
13+
14+
$CMD --features 'stable checked musl-reference-tests'
15+
$CMD --release --features 'stable checked musl-reference-tests'

crates/libm-bench/Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[package]
2+
name = "libm-bench"
3+
version = "0.1.0"
4+
authors = ["Gonzalo Brito Gadeschi <[email protected]>"]
5+
edition = "2018"
6+
license = "MIT OR Apache-2.0"
7+
8+
[dependencies]
9+
libm = { path = "../..", default-features = false }
10+
rand = "0.6.5"
11+
paste = "0.1.5"
12+
13+
[features]
14+
default = []
15+
stable = [ "libm/stable" ]

benches/bench.rs renamed to crates/libm-bench/benches/bench.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
#![feature(test)]
2-
3-
extern crate paste;
4-
extern crate rand;
52
extern crate test;
63

74
use rand::Rng;

0 commit comments

Comments
 (0)