Skip to content

Benchmarks

Dima Lashkov edited this page Feb 2, 2017 · 15 revisions

This compares:

  • defining 25 empty methods via def
  • adding 25 properties via attr_accessor
  • declaring 5 empty constructors in various ways

CRuby 2.3.1

                                     user     system      total        real
25 def:                          0.110000   0.000000   0.110000 (  0.109770)
25 props via attr_accessor:      0.470000   0.000000   0.470000 (  0.469802)
 5 konstructors after:           0.340000   0.000000   0.340000 (  0.343459)
 5 konstructors before:          0.450000   0.010000   0.460000 (  0.453196)
 5 konstructors nameless:        0.550000   0.000000   0.550000 (  0.552251)

CRuby 1.9.3

                                     user     system      total        real
25 def:                          0.240000   0.000000   0.240000 (  0.242842)
25 props via attr_accessor:      0.620000   0.000000   0.620000 (  0.626330)
 5 konstructors after:           0.500000   0.000000   0.500000 (  0.500749)
 5 konstructors before:          0.720000   0.000000   0.720000 (  0.718235)
 5 konstructors nameless:        0.860000   0.000000   0.860000 (  0.857374)

JRuby 2.2.3

                                     user     system      total        real
25 def:                          0.770000   0.010000   0.780000 (  0.193494)
25 props via attr_accessor:      0.940000   0.000000   0.940000 (  0.282903)
 5 konstructors after:           2.980000   0.000000   2.980000 (  0.774344)
 5 konstructors before:          1.600000   0.010000   1.610000 (  0.641741)
 5 konstructors nameless:        1.080000   0.020000   1.100000 (  0.701183)

See task :benchmark in Rakefile for full benchmark source.

Clone this wiki locally