3 ms·
As a very general tip: > execution time: 438.059µs That’s a rather short time. (It’s a lot of cycles, but there are plenty of things one might do on a comput
by amluto 3y ago
As a very general tip:
> execution time: 438.059µs
That’s a rather short time. (It’s a lot of cycles, but there are plenty of things one might do on a computer that take time comparable to this, especially anything involving IO. It’s only a small fraction of a disk head seek if you’re using spinning disks, and it’s only a handful of non-overlapping random accesses even on NVMe.)
So, when you benchmark anything and get a time this short, you should make sure you’re benchmarking the right thing. Watch out for fixed costs or correct for them. Run in a loop and see how time varies with iteration count. Consider using a framework that can handle this type of benchmarking.
A result like “this program took half a millisecond to run” doesn’t really tell you much about how long any part of it took.