Skip to content

Instantly share code, notes, and snippets.

@havenwood
Last active April 18, 2018 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save havenwood/6fed7dd17131330ae4fd36a06fd2c19b to your computer and use it in GitHub Desktop.
Save havenwood/6fed7dd17131330ae4fd36a06fd2c19b to your computer and use it in GitHub Desktop.
Qo benchmarks with TruffleRuby and CRuby (https://github.com/baweaver/qo)
$ ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
$ rake perf
Running on Qo v0.2.1 at commit 8f6b63320e2114c8d5fdafb9333b4d8841745b8f
Array * Array - Literal
=======================
Vanilla result: true
Qo.and result: true
Warming up --------------------------------------
Vanilla 290.577k i/100ms
Qo.and 81.028k i/100ms
Calculating -------------------------------------
Vanilla 9.784M (± 3.3%) i/s - 49.108M in 5.025551s
Qo.and 1.120M (± 5.2%) i/s - 5.591M in 5.006840s
Comparison:
Vanilla: 9783684.7 i/s
Qo.and: 1120104.7 i/s - 8.73x slower
Array * Array - Index pattern match
===================================
Vanilla result: true
Qo.and result: true
Warming up --------------------------------------
Vanilla 67.937k i/100ms
Qo.and 28.943k i/100ms
Calculating -------------------------------------
Vanilla 831.873k (± 2.8%) i/s - 4.212M in 5.067492s
Qo.and 320.045k (± 3.8%) i/s - 1.621M in 5.072213s
Comparison:
Vanilla: 831873.5 i/s
Qo.and: 320044.8 i/s - 2.60x slower
Array * Object - Predicate match
================================
Vanilla result: false
Qo.and result: false
Warming up --------------------------------------
Vanilla 155.974k i/100ms
Qo.and 34.501k i/100ms
Calculating -------------------------------------
Vanilla 2.539M (± 4.0%) i/s - 12.790M in 5.045684s
Qo.and 393.760k (± 3.6%) i/s - 1.967M in 5.001369s
Comparison:
Vanilla: 2539165.4 i/s
Qo.and: 393760.5 i/s - 6.45x slower
Array * Array - Select index pattern match
==========================================
Vanilla result: [["Robert", 22], ["Roberta", 22]]
Qo.and result: [["Robert", 22], ["Roberta", 22]]
Warming up --------------------------------------
Vanilla 21.710k i/100ms
Qo.and 10.484k i/100ms
Calculating -------------------------------------
Vanilla 235.139k (± 2.3%) i/s - 1.194M in 5.080927s
Qo.and 109.692k (± 2.2%) i/s - 555.652k in 5.068045s
Comparison:
Vanilla: 235139.1 i/s
Qo.and: 109691.7 i/s - 2.14x slower
Hash * Hash - Hash intersection
===============================
Vanilla result: [{:name=>"Robert", :age=>22}, {:name=>"Roberta", :age=>22}]
Qo.and result: [{:name=>"Robert", :age=>22}, {:name=>"Roberta", :age=>22}]
Warming up --------------------------------------
Vanilla 52.061k i/100ms
Qo.and 7.475k i/100ms
Calculating -------------------------------------
Vanilla 654.419k (± 3.2%) i/s - 3.280M in 5.017267s
Qo.and 77.690k (± 2.7%) i/s - 396.175k in 5.103240s
Comparison:
Vanilla: 654419.1 i/s
Qo.and: 77690.3 i/s - 8.42x slower
Hash * Object - Property match
==============================
Vanilla result: [#<struct Person name="Robert", age=22>, #<struct Person name="Roberta", age=22>]
Qo.and result: [#<struct Person name="Robert", age=22>, #<struct Person name="Roberta", age=22>]
Warming up --------------------------------------
Vanilla 53.359k i/100ms
Qo.and 8.220k i/100ms
Calculating -------------------------------------
Vanilla 659.030k (± 3.5%) i/s - 3.308M in 5.026156s
Qo.and 85.952k (± 3.1%) i/s - 435.660k in 5.073708s
Comparison:
Vanilla: 659030.1 i/s
Qo.and: 85952.4 i/s - 7.67x slower
$ ruby -v
truffleruby 1.0.0-rc1, like ruby 2.3.7 <native build with Graal> [x86_64-darwin]
$ rake perf
Running on Qo v0.2.1 at commit 8f6b63320e2114c8d5fdafb9333b4d8841745b8f
Array * Array - Literal
=======================
Vanilla result: true
Qo.and result: true
Warming up --------------------------------------
Vanilla 2.523M i/100ms
Qo.and[ruby] PERFORMANCE keyword arguments are not yet optimized
471.400k i/100ms
Calculating -------------------------------------
Vanilla 2.968B (± 6.2%) i/s - 14.410B in 4.992242s
Qo.and 6.865M (±11.6%) i/s - 32.527M in 5.021994s
Comparison:
Vanilla: 2968445092.0 i/s
Qo.and: 6865086.1 i/s - 432.40x slower
Array * Array - Index pattern match
===================================
Vanilla result: true
Qo.and result: true
Warming up --------------------------------------
Vanilla 268.364k i/100ms
Qo.and 95.641k i/100ms
Calculating -------------------------------------
Vanilla 2.623M (±57.8%) i/s - 10.466M in 5.080179s
Qo.and 1.385M (±25.8%) i/s - 6.121M in 5.032195s
Comparison:
Vanilla: 2622982.4 i/s
Qo.and: 1384780.8 i/s - same-ish: difference falls within error
Array * Object - Predicate match
================================
Vanilla result: false
Qo.and result: false
Warming up --------------------------------------
Vanilla 1.854M i/100ms
Qo.and 115.847k i/100ms
Calculating -------------------------------------
Vanilla 42.890M (±25.6%) i/s - 185.391M in 5.019547s
Qo.and 1.131M (±21.7%) i/s - 5.097M in 5.038695s
Comparison:
Vanilla: 42889826.8 i/s
Qo.and: 1130999.1 i/s - 37.92x slower
Array * Array - Select index pattern match
==========================================
Vanilla result: [["Robert", 22], ["Roberta", 22]]
Qo.and result: [["Robert", 22], ["Roberta", 22]]
Warming up --------------------------------------
Vanilla 412.000 i/100ms
Qo.and 482.000 i/100ms
Calculating -------------------------------------
Vanilla 644.822k (±22.7%) i/s - 1.182M in 4.994081s
Qo.and 491.783k (±14.9%) i/s - 1.776M in 4.994044s
Comparison:
Vanilla: 644822.0 i/s
Qo.and: 491782.9 i/s - same-ish: difference falls within error
Hash * Hash - Hash intersection
===============================
Vanilla result: [{:name=>"Robert", :age=>22}, {:name=>"Roberta", :age=>22}]
Qo.and result: [{:name=>"Robert", :age=>22}, {:name=>"Roberta", :age=>22}]
Warming up --------------------------------------
Vanilla 93.799k i/100ms
Qo.and 906.000 i/100ms
Calculating -------------------------------------
Vanilla 1.646M (±26.3%) i/s - 6.754M in 5.021578s
Qo.and 294.364k (±17.1%) i/s - 1.179M in 4.997427s
Comparison:
Vanilla: 1645996.3 i/s
Qo.and: 294363.7 i/s - 5.59x slower
Hash * Object - Property match
==============================
Vanilla result: [#<struct Person name="Robert", age=22>, #<struct Person name="Roberta", age=22>]
Qo.and result: [#<struct Person name="Robert", age=22>, #<struct Person name="Roberta", age=22>]
Warming up --------------------------------------
Vanilla 110.926k i/100ms
Qo.and 16.993k i/100ms
Calculating -------------------------------------
Vanilla 1.769M (±21.0%) i/s - 8.319M in 5.148575s
Qo.and 310.439k (±20.5%) i/s - 1.444M in 5.057214s
Comparison:
Vanilla: 1768923.8 i/s
Qo.and: 310439.4 i/s - 5.70x slower
@havenwood
Copy link
Author

screen shot 2018-04-17 at 11 52 36 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment