Last active
December 16, 2025 05:57
-
-
Save devlongs/2cd9c91ef4cf7f898d0c3e8c43299d74 to your computer and use it in GitHub Desktop.
Simple Manual Timing (Good for Quick Tests) Benchmarking
This file contains hidden or 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
| // A simple manual timing for benchmarking | |
| use std::time::Instant; | |
| fn main() { | |
| let start = Instant::now(); | |
| // Code to benchmark | |
| let result = expensive_function(); | |
| let duration = start.elapsed(); | |
| println!("Time elapsed: {:?}", duration); | |
| } | |
| fn expensive_function() -> u64 { | |
| // Some work here | |
| (0..1000000).sum() | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment