fastest way to detect a user type

Paul Rubin http
Sun Feb 1 03:25:30 EST 2009


Steven D'Aprano <steve at pearwood.info> writes:
> First question is, why do you care that it's slower? The difference between
> the fastest and slowest functions is 1.16-0.33 = 0.83 microsecond. 

That's a 71% speedup, pretty good if you ask me.

> If you call the slowest function one million times, your code will
> run less than a second longer.

What if you call it a billion times, or a trillion times, or a
quadrillion times, you see where this is going?  If you're testing
100-digit numbers, there are an awful lot of them before you run out.



More information about the Python-list mailing list