Это видео недоступно.
Сожалеем об этом.
std::time::Instant | Rust Language
HTML-код
- Опубликовано: 20 май 2024
- Time. Use Instant and elapsed() to benchmark code with an iterator using rev()
This is a basic way to check the time take, there are tools such as Perf and Valgrind for more advanced use cases.
#learningrust #ProgrammingRust
the difference in timings could be because of the println!() macro maybe? what if you try the same but you do not print at line 3 and 10?
That was a great suggestion, thank you - yes, makes a big difference! -
play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=1a6ceacce4bbac87c542a52335e71b97
So println! is best used only at the end, makes sense now!
@@learning_rust cool! I'm fairly new to Rust my self, such an enjoyable language
@@ALL-THE-SUN Yeah, can be difficult, but I like a lot - the more I learn the more I like it- I need a faster laptop to do projects on though, as compiling can take a while...