Skip to content

ssomers/rust_bench_quickies

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

What is this?

Simple benchmarks of Rust (standard library) features.

  • option_cardinality: various ways to convert a boolean to an integer listed under a stackoverflow question, in particular for converting Option::is_some into the number of elements in an Option container.
  • option_unwrap: various ways to unwrap an option when you are sure it cannot be empty.
  • btreeset_binary_contains vs btreeset_binary_contains_if_not_empty: when sets are quite likely to be empty, !set.is_empty() && set.contains(elementt) used to be faster than set.contains(element) on its own.
  • btreeset_general_contains vs btreeset_general_contains_if_not_empty: found the equilibrium where this trick evens out.
  • btreeset_iter vs btreeset_range: creating an iterator takes longer than creating a range, that is kind of a pair of iterators. Which is solved in issue #62924, except that the numbers say it isn't!? To be continued...

How to run this?

rustup install nightly
rustup run nightly cargo bench

About

Very basic benchmarks of some Rust features

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages