unicode() vs. s.decode()

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sat Aug 8 05:29:43 CEST 2009


On Fri, 07 Aug 2009 17:13:07 +0200, Thorsten Kampe wrote:

> One guy claims he has times between 2.7 and 5.7 seconds when
> benchmarking more or less randomly generated "one million different
> lines". That *is* *exactly* nothing.


We agree that in the grand scheme of things, a difference of 2.7 seconds 
versus 5.7 seconds is a trivial difference if your entire program takes 
(say) 8 minutes to run. You won't even notice it.

But why assume that the program takes 8 minutes to run? Perhaps it takes 
8 seconds to run, and 6 seconds of that is the decoding. Then halving 
that reduces the total runtime from 8 seconds to 5, which is a noticeable 
speed increase to the user, and significant if you then run that program 
tens of thousands of times.

The Python dev team spend significant time and effort to get improvements 
of the order of 10%, and you're pooh-poohing an improvement of the order 
of 100%. By all means, reminding people that pre-mature optimization is a 
waste of time, but it's possible to take that attitude too far to Planet 
Bizarro. At the point that you start insisting, and emphasising, that a 
three second time difference is "*exactly*" zero, it seems to me that 
this is about you winning rather than you giving good advice.



-- 
Steven



More information about the Python-list mailing list