News for hackers. Stuff that matters.
Re:Create objects 2x faster in Python by j_baker on Monday June 14, 2010 @05:41PM (#1431097)
This is a pretty bad benchmark. Of course the harbor with pooling is faster. It's creating all 100000 objects outside the timer, while the harbor without pooling is creating them within the timer. If I change the code so that it creates the objects inside the timer, I get the following results which are nowhere near as good:

    Total With Object Pooling: 633.393 ms
    Total Without Object Pooling: 714.89 ms
This is hardly 2x faster and the speed increase that is there probably comes more from allocating the objects in a list comprehension in the pooled harbor.
Re:Create objects 2x faster in Python by ertug on Monday June 14, 2010 @05:52PM (#1431152)
Of course it is creating them outside the timer, the point is pre-allocating objects!
Re:Create objects 2x faster in Python by jrockway on Monday June 14, 2010 @06:12PM (#1431195)
Why not just run your entire program outside the timer? Then it is infinitely fast!