On Tue, 2005-05-10 at 22:06 +0200, Fredrik Johansson wrote:
On 5/10/05, Tim Starling t.starling@physics.unimelb.edu.au wrote:
So don't tell me interpreted languages are getting faster, they're as slow as the day they were invented. If you need to execute large numbers of calls to short-running functions, you're sunk.
I've had some good experience with Python+Psyco. Psyco can deliver excellent performance boosts for tight loops doing simple operations on numbers and strings, and does a good job with function calls.
Using your example, I just timed incrementing an integer variable 10^9 times to 113 seconds with plain Python and 2.35 seconds with Psyco.
In the benchmarks at The Great Computer Language Shootout [1], Python+Psyco is about 5x faster than PHP. It is within 1/10x the speed of C/gcc for most benchmarks. (The worst case, n-body simulation, is 85 times slower than C. However, I tried a trivial optimization for the inner loop and it got twice as fast :-)
I did a small benchmark based on fibonacci(40) recently- Java 1.5 won with 3.95 seconds over C with 4.1 seconds, python/psyco took 9.3 seconds, php 1.5 with eaccelerator didn't finish within two minutes. The Java number is probably the result of some clever caching of previous results within the JVM.
For what it's worth- i'd strongly support a MediaWiki rewrite in Python. I've played with Twisted recently which seems to be particularly well suited to the task of a distributed wiki system with many supported interfaces and protocols, a long-running process and better performance than LAMP. Even MoinMoin on Twisted beats MediaWiki: MediaWiki1.4/PHP5 4.7req/sec, MediaWiki1.4/PHP5/Eaccelerator: 16.2req/sec, Moin 1.3 on Twisted: 34.6req/sec. This is without any use of Psyco, Pyrex or Tisted's new c modules. A simple DB interface app using Nevow on Twisted does 230req/sec on my laptop.