If you're comparing 2.6 vs US Q3, why would you check Python 2.5? Our
baseline is 2.6.1.
> well, anyway, just wanted to share this and ask others for similar
> promissing micro-bmarks slices.
Was this operation a hotspot in one of your applications?
What led you to benchmark this particular snippet of code?
def inc(d,e):
d[e] = d.get(e,0)+1
return d
reduce(inc, [1,2,1,3,2,2], {})
And, as always, the straight-forward loop is the fastest one:
def count_iteratively(lst):
d = {}
for e in lst:
d[e] = d.get(e,0)+1
return d
count_iteratively([1,2,1,3,2,2])
Clearly, I'd be more happy to use short Python statements and leave more optimizations to the language implementation. And I believe LLVM here is a right and already a quite mature choice.
Is this code open source or open source-able? I'd like to include
something like this in our benchmark suite.