What do `ns` and `us` stand for in `timeit` result?

satoru picture satoru · Aug 5, 2012 · Viewed 10.2k times · Source

I was trying to compare performance of two statements with timeit, and the results are something like:

 100 loops, best of 3: 100 ns per loop
 100 loops, best of 3: 1.96 us per loop

But I don't know what these ns and us stands for, so I don't know which one is faster.

Answer

Carl Norum picture Carl Norum · Aug 5, 2012

ns stands for nanoseconds. n is the regular SI prefix meaning 10-9. us means microseconds. In SI that would be µs (10-6 seconds) - the u is used because there's not a µ in ASCII, but it does look pretty similar. In your case, that means you're comparing 100×10-9 seconds against 1.96×10-6 seconds - the former is almost 20× faster.