Benchmark Updates

With the release of the major Ruby versions during the past 4 weeks
I thought it would be interesting to run my primeszp benchmark on them.

The updated Ruby versions (via rvm) are:
Ruby 2.1.0-preview (2.1.0dev)
Ruby 2.0.0-p247
JRuby 1.7.5
Rubinius 2.1.1

System:
Lenovo V570 laptop; I5 64-bit, 2.3 GHz, 6GB ram
PCLOS KDE 32-bit, Linux 3.4.66-pae

Here is the paper on the what/why/how of the benchmarks:
http://www.scribd.com/doc/150217723/Improved-Primality-Testing-and-Factorization-in-Ruby-revised

Here is the benchmark source code:
https://gist.github.com/jzakiya/455f2357cdb08f4ee1c4

Here are the results on my system:

2.1.0dev :003 > load ‘~/Primes/primeszp.rb’
Rehearsal

prime tests for P = 20000000000000003 0.000000 0.000000 0.000000 (
0.000011)
Miller-Rabin 0.000000 0.000000 0.000000 (
0.002235)
primality? 0.000000 0.000000 0.010000 (
0.006839)
primzp7? 37.560000 0.000000 37.560000 (
37.842402)
primzp7a? 15.710000 0.000000 15.710000 (
15.812023)
primzp7b? 15.960000 0.000000 15.960000 (
16.077675)
primzp? 13 15.430000 0.000000 15.430000 (
15.552218)
primzp? 17 14.700000 0.000000 14.700000 (
14.809259)
primzpa? 13 14.800000 0.020000 14.820000 (
14.918595)
primzpa? 17 9.870000 0.030000 9.900000 (
9.943070)
factors 0.000000 0.000000 0.000000 (
0.006584)
factorzp 13 8.140000 0.000000 8.140000 (
8.170701)
factorzp 17 7.700000 0.000000 7.700000 (
7.725391)
prime? [ruby lib] 45.180000 0.000000 45.180000 (
45.332839)
prime_division [ruby lib] 47.570000 0.010000 47.580000 (
47.724047)
-------------------------------------------------------------- total:
232.690000sec

                                        user     system      total

real
prime tests for P = 20000000000000003 0.000000 0.000000 0.000000 (
0.000007)
Miller-Rabin 0.000000 0.000000 0.000000 (
0.000855)
primality? 0.000000 0.000000 0.000000 (
0.001202)
primzp7? 9.580000 0.040000 9.620000 (
9.683138)
primzp7a? 7.380000 0.040000 7.420000 (
7.491261)
primzp7b? 7.440000 0.020000 7.460000 (
7.514076)
primzp? 13 7.960000 0.030000 7.990000 (
8.057535)
primzp? 17 7.570000 0.030000 7.600000 (
7.643980)
primzpa? 13 10.150000 0.060000 10.210000 (
10.273793)
primzpa? 17 9.700000 0.090000 9.790000 (
9.855217)
factors 0.000000 0.000000 0.000000 (
0.003174)
factorzp 13 8.000000 0.030000 8.030000 (
8.088394)
factorzp 17 7.600000 0.020000 7.620000 (
7.674372)
prime? [ruby lib] 44.400000 0.090000 44.490000 (
44.711723)
prime_division [ruby lib] 46.580000 0.080000 46.660000 (
46.862469)
=> true

2.0.0p247 :004 > load ‘~/Primes/primeszp.rb’
Rehearsal

prime tests for P = 20000000000000003 0.000000 0.000000 0.000000 (
0.000018)
Miller-Rabin 0.000000 0.000000 0.000000 (
0.002147)
primality? 0.000000 0.000000 0.000000 (
0.003875)
primzp7? 11.300000 0.070000 11.370000 (
11.485364)
primzp7a? 9.190000 0.020000 9.210000 (
9.260024)
primzp7b? 9.170000 0.020000 9.190000 (
9.244555)
primzp? 13 9.470000 0.010000 9.480000 (
9.528481)
primzp? 17 9.230000 0.020000 9.250000 (
9.312807)
primzpa? 13 11.250000 0.030000 11.280000 (
11.341389)
primzpa? 17 11.480000 0.020000 11.500000 (
11.564664)
factors 0.000000 0.000000 0.010000 (
0.002990)
factorzp 13 9.540000 0.000000 9.540000 (
9.577411)
factorzp 17 9.310000 0.000000 9.310000 (
9.351429)
prime? [ruby lib] 49.890000 0.010000 49.900000 (
50.074571)
prime_division [ruby lib] 52.070000 0.000000 52.070000 (
52.272930)
-------------------------------------------------------------- total:
192.110000sec

                                        user     system      total

real
prime tests for P = 20000000000000003 0.000000 0.000000 0.000000 (
0.000004)
Miller-Rabin 0.000000 0.000000 0.000000 (
0.000730)
primality? 0.000000 0.000000 0.000000 (
0.001796)
primzp7? 11.350000 0.020000 11.370000 (
11.447762)
primzp7a? 9.200000 0.040000 9.240000 (
9.300143)
primzp7b? 9.260000 0.040000 9.300000 (
9.379688)
primzp? 13 9.500000 0.050000 9.550000 (
9.655002)
primzp? 17 9.310000 0.020000 9.330000 (
9.388130)
primzpa? 13 11.220000 0.030000 11.250000 (
11.324035)
primzpa? 17 11.430000 0.030000 11.460000 (
11.549566)
factors 0.000000 0.000000 0.000000 (
0.003004)
factorzp 13 9.540000 0.000000 9.540000 (
9.579920)
factorzp 17 9.350000 0.000000 9.350000 (
9.389692)
prime? [ruby lib] 49.910000 0.010000 49.920000 (
50.094428)
prime_division [ruby lib] 51.990000 0.000000 51.990000 (
52.181253)
=> true

jruby-1.7.5 :002 > load ‘~/Primes/primeszp.rb’
Rehearsal

prime tests for P = 20000000000000003 0.000000 0.000000 0.000000 (
0.000000)
Miller-Rabin 0.010000 0.000000 0.010000 (
0.002000)
primality? 0.000000 0.000000 0.000000 (
0.007000)
primzp7? 12.820000 0.020000 12.840000 (
12.802000)
primzp7a? 3.430000 0.020000 3.450000 (
3.444000)
primzp7b? 3.740000 0.000000 3.740000 (
3.742000)
primzp? 13 10.730000 0.020000 10.750000 (
10.726000)
primzp? 17 10.410000 0.010000 10.420000 (
10.394000)
primzpa? 13 5.300000 0.020000 5.320000 (
5.297000)
primzpa? 17 5.520000 0.000000 5.520000 (
5.434000)
factors 0.000000 0.010000 0.010000 (
0.008000)
factorzp 13 10.720000 0.010000 10.730000 (
10.722000)
factorzp 17 10.820000 0.020000 10.840000 (
10.605000)
prime? [ruby lib] 84.250000 0.110000 84.360000 (
83.371000)
prime_division [ruby lib] 90.830000 0.110000 90.940000 (
90.645000)
-------------------------------------------------------------- total:
248.930000sec

                                        user     system      total

real
prime tests for P = 20000000000000003 0.000000 0.000000 0.000000 (
0.000000)
Miller-Rabin 0.000000 0.000000 0.000000 (
0.003000)
primality? 0.010000 0.000000 0.020000 (
0.006000)
primzp7? 13.590000 0.010000 13.600000 (
13.570000)
primzp7a? 3.530000 0.010000 3.540000 (
3.532000)
primzp7b? 3.750000 0.010000 3.760000 (
3.753000)
primzp? 13 11.260000 0.020000 11.280000 (
11.259000)
primzp? 17 10.950000 0.020000 10.970000 (
10.942000)
primzpa? 13 5.350000 0.010000 5.360000 (
5.340000)
primzpa? 17 5.490000 0.010000 5.500000 (
5.407000)
factors 0.000000 0.000000 0.000000 (
0.008000)
factorzp 13 11.250000 0.030000 11.280000 (
11.276000)
factorzp 17 11.110000 0.020000 11.130000 (
11.083000)
prime? [ruby lib] 84.340000 0.120000 84.460000 (
84.023000)
prime_division [ruby lib] 90.950000 0.130000 91.080000 (
90.778000)
=> true

rubinius-2.1.1 :002 > load ‘~/Primes/primeszp.rb’
Rehearsal

prime tests for P = 20000000000000003 0.000000 0.000000 0.000000 (
0.000005)
Miller-Rabin 0.001000 0.000000 0.001000 (
0.001358)
primality? 0.000000 0.001000 0.003000 (
0.103679)
primzp7? 21.720698 0.061990 21.782688 (
21.921358)
primzp7a? 13.285980 0.033995 13.319975 (
13.395240)
primzp7b? 13.323975 0.029996 13.353971 (
13.430817)
primzp? 13 18.431198 0.016997 18.448195 (
18.531514)
primzp? 17 17.743302 0.020997 17.764299 (
17.857458)
primzpa? 13 10.382422 0.029995 10.412417 (
10.486547)
primzpa? 17 10.857349 0.029996 10.887345 (
10.969337)
factors 0.000000 0.000000 0.001000 (
0.002473)
factorzp 13 18.031259 0.058991 18.090250 (
18.194014)
factorzp 17 17.113398 0.023996 17.137394 (
17.209936)
prime? [ruby lib] 69.628415 0.232965 69.861380 (
70.224269)
prime_division [ruby lib] 72.373998 0.180972 72.554970 (
72.877380)
-------------------------------------------------------------- total:
283.617884sec

                                        user     system      total

real
prime tests for P = 20000000000000003 0.000000 0.000000 0.000000 (
0.000007)
Miller-Rabin 0.002000 0.000000 0.002000 (
0.002196)
primality? 0.000000 0.001000 0.002000 (
0.030810)
primzp7? 21.446740 0.020997 21.467737 (
21.583580)
primzp7a? 12.908037 0.021997 12.930034 (
13.003202)
primzp7b? 12.931035 0.019997 12.951032 (
13.017072)
primzp? 13 10.794359 0.014997 10.809356 (
10.867132)
primzp? 17 10.270439 0.023997 10.294436 (
10.356949)
primzpa? 13 10.315432 0.036994 10.352426 (
10.424680)
primzpa? 17 10.914341 0.044993 10.959334 (
11.040405)
factors 0.000000 0.000000 0.000000 (
0.001613)
factorzp 13 10.814356 0.023996 10.838352 (
10.903393)
factorzp 17 10.340428 0.026996 10.367424 (
10.435315)
prime? [ruby lib] 68.823537 0.228965 69.052502 (
69.441892)
prime_division [ruby lib] 72.934912 0.248963 73.183875 (
73.560724)
=> true

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs