-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,3 +138,26 @@ jobs: | |
target | ||
key: examples-bench-${{ runner.os }} | ||
- run: cargo bench -p examples --all-features | ||
|
||
# Run `internal_benches/` directory as benchmarks. | ||
internals-bench: | ||
name: Internals Bench | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
# Run each benchmark within 2 seconds. | ||
DIVAN_MAX_TIME: 2 | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
- macos-latest | ||
- windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/[email protected] | ||
with: | ||
path: | | ||
${{ env.CARGO_HOME }} | ||
target | ||
key: internals-bench-${{ runner.os }} | ||
- run: cargo bench -p internal_benches --all-features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
name = "internal_benches" | ||
version = "0.0.0" | ||
edition = "2021" | ||
authors = ["Nikolai Vazquez"] | ||
license = "MIT OR Apache-2.0" | ||
description = "Internal benchmarks for Divan, a comfy benchmarking framework." | ||
readme = "../README.md" | ||
publish = false | ||
|
||
[dependencies] | ||
divan = { workspace = true, features = ["internal_benches"] } | ||
|
||
[[bench]] | ||
name = "internals" | ||
harness = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Divan Internal Benchmarks | ||
|
||
This crate demonstrates how to use [Divan] to benchmark internals of a crate by | ||
benchmarking the internals of Divan. | ||
|
||
These can be benchmarked locally by running: | ||
|
||
```sh | ||
git clone https://github.com/nvzqz/divan.git | ||
cd divan | ||
|
||
cargo bench -q -p internal_benches | ||
``` | ||
|
||
As of this writing, the output on my machine is: | ||
|
||
```txt | ||
divan fastest │ slowest │ median │ mean │ samples │ iters | ||
╰─ time │ │ │ │ │ | ||
╰─ timer │ │ │ │ │ | ||
├─ get_tsc 0.158 ns │ 0.202 ns │ 0.161 ns │ 0.162 ns │ 100 │ 1638400 | ||
╰─ measure │ │ │ │ │ | ||
├─ precision 89.58 µs │ 221.5 µs │ 201.9 µs │ 184.5 µs │ 100 │ 100 | ||
╰─ sample_loop_overhead 314.2 µs │ 342.5 µs │ 314.5 µs │ 317.1 µs │ 100 │ 100 | ||
``` | ||
|
||
[divan]: https://github.com/nvzqz/divan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn main() { | ||
divan::main(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters