forked from open-telemetry/opentelemetry-rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add benchmarks to show cost of random generation (open-telemetry#1667)
- Loading branch information
1 parent
758cdd7
commit 590c7ab
Showing
4 changed files
with
39 additions
and
9 deletions.
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
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
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,14 @@ | ||
use rand::{rngs::SmallRng, Rng, SeedableRng}; | ||
|
||
mod throughput; | ||
|
||
fn main() { | ||
throughput::test_throughput(test_random_generation); | ||
} | ||
|
||
fn test_random_generation() { | ||
let mut rng = SmallRng::from_entropy(); | ||
let _index_first_attribute = rng.gen_range(0..10); | ||
let _index_second_attribute = rng.gen_range(0..10); | ||
let _index_third_attribute = rng.gen_range(0..10); | ||
} |