29

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.

satoru
  • 31,822
  • 31
  • 91
  • 141

2 Answers2

46

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.

Carl Norum
  • 219,201
  • 40
  • 422
  • 469
10

Nanoseconds and microseconds... 10-9 and 10-6 respectively.

Makoto
  • 104,088
  • 27
  • 192
  • 230
Joran Beasley
  • 110,522
  • 12
  • 160
  • 179