Это видео недоступно.
Сожалеем об этом.

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

Комментарии • 4

  • @ALL-THE-SUN
    @ALL-THE-SUN 2 месяца назад +2

    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?

    • @learning_rust
      @learning_rust  2 месяца назад +1

      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!

    • @ALL-THE-SUN
      @ALL-THE-SUN 2 месяца назад +1

      @@learning_rust cool! I'm fairly new to Rust my self, such an enjoyable language

    • @learning_rust
      @learning_rust  2 месяца назад

      @@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...