Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Rust High Performance

You're reading from   Rust High Performance Learn to skyrocket the performance of your Rust applications

Arrow left icon
Product type Paperback
Published in Mar 2018
Publisher Packt
ISBN-13 9781788399487
Length 272 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Iban Eguia Moraza Iban Eguia Moraza
Author Profile Icon Iban Eguia Moraza
Iban Eguia Moraza
Arrow right icon
View More author details
Toc

Benchmarking in stable Rust

Until now, we have seen how to benchmark our code using the nightly release channel. This is because Rust requires the test nightly feature for benchmarks to run. It's where the test crate and the Bencher types can be found. If you still want to be able to use the stable compiler for everything except benchmarks, you can put all your benchmarks in the benches directory. The stable compiler will ignore them for normal builds, but the nightly compiler will be able to run them.

But, if you really want to use the stable compiler to run benchmarks, you can use the bencher crate. You can find it in crates.io, and using it is really similar to using the built-in nightly benchmarks, since this crate is just a stable port of the benchmarking library.

To use it, you will need to first change the Cargo.toml file to make sure it looks like the following after...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at AU $24.99/month. Cancel anytime