I've uploaded optimized upgraded versions of my SoZ prime generators,
with included benchmarks against the Sieve of Atkin (SoA) and Sieve of
Eratosthenes (SoE). Available here:
http://www.4shared.com/dir/7467736/97bd7b71/sharing.html
I've tried to run my Ruby code with JRuby, but I can't get JRuby to
install correctly on my laptop (w/PCLinuxOS, Intel P4 2.8Ghz).
I would appreciate if someone would run my code under JRuby, Rubinius,
et al, and post results.
$ uname -a
Linux ViBEStation-alpha 2.6.27-7-generic #1 SMP Fri Oct 24 06:42:44
UTC 2008 i686 GNU/Linux
$ cat /proc/cpuinfo | fgrep "model name"
model name : Genuine Intel(R) CPU T2400 @ 1.83GHz
model name : Genuine Intel(R) CPU T2400 @ 1.83GHz
$ cat /proc/meminfo | fgrep MemTotal
MemTotal: 1552052 kB
$ ruby1.8 -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
$ ruby1.9 -v
ruby 1.9.0 (2008-06-20 revision 17482) [i486-linux]
$ jruby -v
jruby 1.1.5 (ruby 1.8.6 patchlevel 114) (2008-11-03 rev 7996) [i386-java]
$ java -version
java version "1.6.0_0"
IcedTea6 1.3.1 (6b12-0ubuntu6) Runtime Environment (build 1.6.0_0-b12)
OpenJDK Client VM (build 1.6.0_0-b12, mixed mode, sharing)
$ ruby1.8 SieveOfZakiya.rb
user system total real
primes up to 10000001: 12.060000 3.290000 15.350000 ( 15.416156)
primes up to 10000001: 16.500000 2.690000 19.190000 ( 19.257785)
primes up to 10000001: 4.530000 0.210000 4.740000 ( 4.748393)
primes up to 10000001: 18.600000 2.510000 21.110000 ( 21.313465)
primes up to 10000001: 11.830000 1.840000 13.670000 ( 13.736428)
primes up to 10000001: 9.470000 1.300000 10.770000 ( 10.836533)
primes up to 10000001: 8.810000 1.320000 10.130000 ( 10.169567)
primes up to 10000001: 6.640000 0.210000 6.850000 ( 6.901754)
primes up to 10000001: 4.650000 0.160000 4.810000 ( 4.859772)
primes up to 10000001: 4.000000 0.190000 4.190000 ( 4.261946)
primes up to 10000001: 7.780000 0.210000 7.990000 ( 8.005944)
$ ruby1.9 SieveOfZakiya.rb
user system total real
primes up to 10000001: 3.970000 0.020000 3.990000 ( 4.038134)
primes up to 10000001: 4.700000 0.040000 4.740000 ( 4.750093)
primes up to 10000001: 1.770000 0.050000 1.820000 ( 1.825153)
primes up to 10000001: 6.190000 0.080000 6.270000 ( 6.293999)
primes up to 10000001: 4.120000 0.080000 4.200000 ( 4.220465)
primes up to 10000001: 3.360000 0.060000 3.420000 ( 3.427870)
primes up to 10000001: SieveOfZakiya.rb:962: [BUG] Segmentation fault
ruby 1.9.0 (2008-06-20 revision 17482) [i486-linux]
$ jruby SieveOfZakiya.rb
Error, could not compile; pass -d or
-J-Djruby.jit.logging.verbose=true for more details
user system total real
primes up to 10000001: 10.529000 0.000000 10.529000 ( 10.528562)
primes up to 10000001: 14.105000 0.000000 14.105000 ( 14.105188)
primes up to 10000001: 7.248000 0.000000 7.248000 ( 7.248299)
primes up to 10000001: 15.564000 0.000000 15.564000 ( 15.564142)
primes up to 10000001: 11.170000 0.000000 11.170000 ( 11.170565)
primes up to 10000001: 8.735000 0.000000 8.735000 ( 8.734701)
primes up to 10000001: 9.330000 0.000000 9.330000 ( 9.330105)
primes up to 10000001: 11.366000 0.000000 11.366000 ( 11.365478)
primes up to 10000001: 8.015000 0.000000 8.015000 ( 8.015094)
primes up to 10000001: 12.421000 0.000000 12.421000 ( 12.420387)
primes up to 10000001: 14.079000 0.000000 14.079000 ( 14.079476)
$ python -V
Python 2.5.2
$ python Sieves.py
Traceback (most recent call last):
File "Sieves.py", line 30, in <module>
import psyco; psyco.full()
ImportError: No module named psyco
$ python Sieves.py
5 0.000430822372437 0.00113892555237 0.000353097915649
0.00146794319153 0.0988550186157
1000005 0.0542759895325 0.0466251373291 0.030809879303 0.0351409912109
0.318035125732
2000005 0.114179849625 0.104732990265 0.0793678760529 0.071692943573
0.142382144928
3000005 0.185572147369 0.170922994614 0.133031129837 0.12051987648
0.174972057343
4000005 0.268694877625 0.239547967911 0.192733049393 0.169470071793
0.171880960464
5000005 0.346322059631 0.307791948318 0.243360996246 0.21952009201
0.220386981964
6000005 0.43289399147 0.449116945267 0.302098035812 0.268841981888
0.269742965698
7000005 0.51304602623 0.448477983475 0.356249094009 0.31923699379 0.319150924683
8000005 0.598546981812 0.519491910934 0.415519952774 0.372243881226
0.374433994293
9000005 0.671094894409 0.591510057449 0.469482898712 0.424551010132
0.42044210434
10000005 0.757035017014 0.669479131699 0.5306661129 0.481162071228
0.471302032471
11000005 0.8411860466 0.747767925262 0.612731933594 0.523928880692
0.520886898041
12000005 0.920516967773 0.8079829216 0.652818202972 0.608549118042
0.570842981339
13000005 1.02680706978 0.879048109055 0.708424806595 0.627990007401
0.618942975998
14000005 1.08641910553 0.952656030655 0.779363870621 0.689521074295
0.667888879776
15000005 1.16809296608 1.02370405197 0.817245006561 0.72927904129 0.747013092041
16000005 1.24769997597 1.12631702423 0.87025809288 0.789395809174 0.765959024429
17000005 1.34199690819 1.16786408424 0.931406021118 0.826653003693
0.818248033524
18000005 1.41291308403 1.2686560154 0.988373041153 0.878173112869 0.867197990417
19000005 1.49461913109 1.34461092949 1.04254007339 0.94869184494 0.916136980057
20000005 1.58202815056 1.4249458313 1.1114461422 0.978127002716 0.96474814415