One thing that caught my eye in the Euler test results is that Unladen Swallow comes in with a total time of 509.72 (seconds?) vs. CPython’s 569.37. That’s an improvement of about 10%. When you look at the wins, Unladen Swallow has 33 vs. CPython’s 51. That 5x improvement on CPython looks pretty far off. [...]
Archives for October, 2010
PyPy outperforming CPython and Psyco
David Ripton ran a bunch of implementations against his collection of Euler Challenge solutions: And now PyPy is clearly the fastest Python implementation for this code, with both the most wins and the lowest overall time. Psyco is still pretty close. Both are a bit more than twice as fast as CPython. I’d really like [...]
Compute all permutations of a string in Python
The Problem Here’s a problem I was asked recently: Write a function permute such that: permute(‘abc’) → ['abc', 'acb', 'bac', 'bca', 'cab', 'cba'] Now, immediately this should look like a recursive problem. Put in English, we want to do the following: Iterate through the initial string – e.g., ‘abc’. For each character in the initial [...]
Posts