benchmark
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Thu Aug 7 02:18:22 EDT 2008
On Thu, 07 Aug 2008 07:49:45 +0200, Stefan Behnel wrote:
> Jack wrote:
>> I know one benchmark doesn't mean much but it's still disappointing to
>> see Python as one of the slowest languages in the test:
>>
>> http://blog.dhananjaynene.com/2008/07/performance-comparison-c-java-
python-ruby-jython-jruby-groovy/
>
> Just ignore that. If the code had been designed for Python from the
> start, it would have performed a lot better.
I recommend folks copy and paste his code into an interactive session,
and watch the thousands of <__main__.Person object at 0xb7f18e2c> that
flash onto the screen. You want to know why it's so slow? That's part of
the reason.
Doing so on my computer gives a final result of:
"Time per iteration = 502.890818119 microseconds"
When I make a single, two character modification to the program
(inserting "t=" at the beginning of the line "chain.kill(3)"), I get this
instead:
"Time per iteration = 391.469910145 microseconds"
In other words, about 20% of the time he measures is the time taken to
print junk to the screen.
--
Steven
More information about the Python-list
mailing list