Jeff wrote:Well, look at the numbers. It's making arrays of 512 * 10000 elements. Run it with smaller sizes and multiply the results. The array is used for constant access speeds.
The same with the other languages.
Xytroxon - it ran consistently at 20-21 seconds on my 2.5 ghz quad-core ppc with 4 gigs of ram.
Backed it down to 1000
D:\MinGW - 18:14:04.58 Tue 09-02-2008
->"c:\program files\php5\php.exe" test.php
Primes up to 1000 168
Primes up to 0 0
Primes up to 0 0
D:\MinGW - 18:14:30.78 Tue 09-02-2008
->nl test.nl
Primes up to 512000 42445
Primes up to 256000 22525
Primes up to 128000 11987
D:\MinGW - 18:16:20.52 Tue 09-02-2008
->lua test.lua
"C:\Lua\lua5.1.exe" test.lua
Primes up to 4000 550
Primes up to 2000 303
Primes up to 1000 168
----
The spaces all look right, but Python is still MIA...
-----
While newLISP takes a few minutes to run... It looks like it is doing the calculations on this machine! Amazing!!!
Is thw PHP code the problem? Or is the Zend engine kicking in to help the speed???
This was fun... Timw for supper!!!
"Many computers can print only capital letters, so we shall not use lowercase letters."
-- Let's Talk Lisp (c) 1976