RSS
 

Archive for September 6th, 2010

Ruby 1.9.2 prestazioni al top

06 Sep

Con un precedente test, avevo riscontrato che JRuby era la massima espressione per quanto riguardava la velocità nell’eseguire codice ruby, surclassando non solo gli altri interpreti C++ e .Net ma azzardando prepotenti confronti con le ultime due incarnazioni di python. Gli script erano questi e li ho rispolverati anche per questo nuovo confronto.

Ora che Rails 3 è stato rilasciato ed uno degli interpreti consigliati è il nuovo 1.9.2, ero curioso di osservare come si comporta la release ufficiale: direi davvero niente male!
Questa volta ho ristretto il numero dei partecipanti alle sole versioni installate con RVM più un paio di versioni windows: JRuby 1.4.0 ed il più usato 1.8.7 mingw32, giusto per avere un metro di paragone.

Distribuzione Linux: Ubuntu 10.4 64bit
Windows XP 32Bit SP3

Versione Compilatore/Sistema Secondi
Ruby 1.9.2 p0 RVM x86_64-linux 6,6
JRuby 1.4.0 RVM OpenJDK 64-Bit Server VM 1.6.0_18 [amd64-java] 6,8
JRuby 1.5.2 RVM OpenJDK 64-Bit Server VM 1.6.0_18 [amd64-java] 7,0
JRuby 1.4.0 Windows Client VM 1.6.0_15 [x86-java] 7,0
Ruby 1.9.1 p378 RVM x86_64-linux 8,9
Ruby 1.8.7 p249 RVM x86_64-linux 12,2
Ruby 1.8.7 p249 i386-mingw32 23,9

Questo il log completo dell’esecuzione:


marco@d9400:~$ rvm list

rvm rubies

=> jruby-1.4.0 [ amd64-java ]
jruby-1.5.2 [ amd64-java ]
ruby-1.8.7-p249 [ x86_64 ]
ruby-1.9.1-p378 [ x86_64 ]
ruby-1.9.2-p0 [ x86_64 ]

marco@d9400:~$ java -version
java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8.1) (6b18-1.8.1-0ubuntu1)
OpenJDK 64-Bit Server VM (build 16.0-b13, mixed mode)

marco@d9400:~$ ruby -v
jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2009-11-02 69fbfa3) (OpenJDK 64-Bit Server VM 1.6.0_18) [amd64-java]
marco@d9400:~$ ruby RubyMM186_3.rb --server --fast

Warming up...
Strings test - Elapsed 2.096
Check1: 50000
Check2: 157490
Check3: 50005
Check4: 373847
Arrays test - Elapsed 3.508
Check1: 20900
Check2: 250000
Check3: 250000
Check4: 1500000
Check5: 5749950
Numeric test - Elapsed 2.856
Check1: 6252500
Check2: 1439295494700374021157505910939096377494040420940312
Ruby Partial elapsed time 8.460

1. Starting Ruby tests...
Strings test - Elapsed 1.501
Arrays test - Elapsed 3.054
Numeric test - Elapsed 2.280
Ruby Partial elapsed time 6.835

2. Starting Ruby tests...
Strings test - Elapsed 1.431
Arrays test - Elapsed 3.091
Numeric test - Elapsed 2.249
Ruby Partial elapsed time 6.771

3. Starting Ruby tests...
Strings test - Elapsed 1.505
Arrays test - Elapsed 2.999
Numeric test - Elapsed 2.261
Ruby Partial elapsed time 6.765
-------------------------------------
Average Strings test - Elapsed 1.479
Average Arrays test - Elapsed 3.048
Average Numeric test - Elapsed 2.263

Ruby Average elapsed time 6.790

marco@d9400:~$ rvm use jruby-1.5.2
marco@d9400:~$ ruby -v
jruby 1.5.2 (ruby 1.8.7 patchlevel 249) (2010-08-20 1c5e29d) (OpenJDK 64-Bit Server VM 1.6.0_18) [amd64-java]
marco@d9400:~$ ruby RubyMM186_3.rb --server --fast

Warming up...
Strings test - Elapsed 2.383
Check1: 50000
Check2: 157490
Check3: 50005
Check4: 373847
Arrays test - Elapsed 3.561
Check1: 20900
Check2: 250000
Check3: 250000
Check4: 1500000
Check5: 5749950
Numeric test - Elapsed 3.210
Check1: 6252500
Check2: 1439295494700374021157505910939096377494040420940312
Ruby Partial elapsed time 9.154

1. Starting Ruby tests...
Strings test - Elapsed 1.479
Arrays test - Elapsed 3.092
Numeric test - Elapsed 2.516
Ruby Partial elapsed time 7.087

2. Starting Ruby tests...
Strings test - Elapsed 1.431
Arrays test - Elapsed 3.056
Numeric test - Elapsed 2.508
Ruby Partial elapsed time 6.995

3. Starting Ruby tests...
Strings test - Elapsed 1.423
Arrays test - Elapsed 3.053
Numeric test - Elapsed 2.524
Ruby Partial elapsed time 7.000
-------------------------------------
Average Strings test - Elapsed 1.444
Average Arrays test - Elapsed 3.067
Average Numeric test - Elapsed 2.516

Ruby Average elapsed time 7.027

marco@d9400:~$ rvm use ruby-1.8.7-p249
marco@d9400:~$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
marco@d9400:~$ ruby RubyMM186_3.rb

Warming up...
Strings test - Elapsed 3.135
Check1: 50000
Check2: 157490
Check3: 50005
Check4: 373847
Arrays test - Elapsed 4.386
Check1: 20900
Check2: 250000
Check3: 250000
Check4: 1500000
Check5: 5749950
Numeric test - Elapsed 4.629
Check1: 6252500
Check2: 1439295494700374021157505910939096377494040420940312
Ruby Partial elapsed time 12.149

1. Starting Ruby tests...
Strings test - Elapsed 3.181
Arrays test - Elapsed 4.402
Numeric test - Elapsed 4.598
Ruby Partial elapsed time 12.180

2. Starting Ruby tests...
Strings test - Elapsed 3.153
Arrays test - Elapsed 4.387
Numeric test - Elapsed 4.572
Ruby Partial elapsed time 12.113

3. Starting Ruby tests...
Strings test - Elapsed 3.210
Arrays test - Elapsed 4.395
Numeric test - Elapsed 4.583
Ruby Partial elapsed time 12.189
-------------------------------------
Average Strings test - Elapsed 3.181
Average Arrays test - Elapsed 4.395
Average Numeric test - Elapsed 4.584

Ruby Average elapsed time 12.160

marco@d9400:~$ rvm use ruby-1.9.1
marco@d9400:~$ ruby -v
ruby 1.9.1p378 (2010-01-10 revision 26273) [x86_64-linux]
marco@d9400:~$ ruby RubyMM191_3.rb

Warming up...
Strings test - Elapsed 2.452
Check1: 50000
Check2: 157490
Check3: 50005
Check4: 373847
Arrays test - Elapsed 4.488
Check1: 20900
Check2: 250000
Check3: 250000
Check4: 1500000
Check5: 5749950
Numeric test - Elapsed 1.840
Check1: 6252500
Check2: 1439295494700374021157505910939096377494040420940312
Ruby Partial elapsed time 8.780

1. Starting Ruby tests...
Strings test - Elapsed 2.314
Arrays test - Elapsed 4.679
Numeric test - Elapsed 1.843
Ruby Partial elapsed time 8.836

2. Starting Ruby tests...
Strings test - Elapsed 2.319
Arrays test - Elapsed 4.691
Numeric test - Elapsed 1.843
Ruby Partial elapsed time 8.853

3. Starting Ruby tests...
Strings test - Elapsed 2.318
Arrays test - Elapsed 4.705
Numeric test - Elapsed 1.847
Ruby Partial elapsed time 8.870
-------------------------------------
Average Strings test - Elapsed 2.317
Average Arrays test - Elapsed 4.692
Average Numeric test - Elapsed 1.844

Ruby Average elapsed time 8.853

marco@d9400:~$ rvm use ruby-1.9.2
marco@d9400:~$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]
marco@d9400:~$ ruby RubyMM191_3.rb

Warming up...
Strings test - Elapsed 1.680
Check1: 50000
Check2: 157490
Check3: 50005
Check4: 373847
Arrays test - Elapsed 4.192
Check1: 20900
Check2: 250000
Check3: 250000
Check4: 1500000
Check5: 5749950
Numeric test - Elapsed 1.708
Check1: 6252500
Check2: 1439295494700374021157505910939096377494040420940312
Ruby Partial elapsed time 7.579

1. Starting Ruby tests...
Strings test - Elapsed 1.654
Arrays test - Elapsed 3.178
Numeric test - Elapsed 1.704
Ruby Partial elapsed time 6.536

2. Starting Ruby tests...
Strings test - Elapsed 1.746
Arrays test - Elapsed 3.388
Numeric test - Elapsed 1.699
Ruby Partial elapsed time 6.833

3. Starting Ruby tests...
Strings test - Elapsed 1.644
Arrays test - Elapsed 3.227
Numeric test - Elapsed 1.706
Ruby Partial elapsed time 6.577
-------------------------------------
Average Strings test - Elapsed 1.681
Average Arrays test - Elapsed 3.264
Average Numeric test - Elapsed 1.703

Ruby Average elapsed time 6.649

 
Comments Off

Posted in JRuby, Ruby