Re: fastest way to detect a user type

2009-02-01 Thread Steven D'Aprano
Robin Becker wrote: Whilst considering a port of old code to python 3 I see that in several places we are using type comparisons to control processing of user instances (as opposed to instances of built in types eg float, int, str) I find that the obvious alternatives are not as fast as the

Re: fastest way to detect a user type

2009-02-01 Thread Paul Rubin
Steven D'Aprano st...@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

Re: fastest way to detect a user type

2009-02-01 Thread Steven D'Aprano
Paul Rubin wrote: Steven D'Aprano st...@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. Don't you care that the code is

Re: fastest way to detect a user type

2009-02-01 Thread Robin Becker
Steven D'Aprano wrote: Paul Rubin wrote: Steven D'Aprano st...@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. Don't you

Re: fastest way to detect a user type

2009-02-01 Thread Steven D'Aprano
Robin Becker wrote: Steven D'Aprano wrote: Paul Rubin wrote: Steven D'Aprano st...@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

fastest way to detect a user type

2009-01-31 Thread Robin Becker
Whilst considering a port of old code to python 3 I see that in several places we are using type comparisons to control processing of user instances (as opposed to instances of built in types eg float, int, str) I find that the obvious alternatives are not as fast as the current code; func0