Skip to content

Instantly share code, notes, and snippets.

@solnic
Last active November 13, 2018 09:38
Show Gist options
  • Save solnic/49db2edcc6f195feeab80b0fe2fcc25a to your computer and use it in GitHub Desktop.
Save solnic/49db2edcc6f195feeab80b0fe2fcc25a to your computer and use it in GitHub Desktop.
rom vs ar benchmark on MRI 2.6.0 with and without jit
git clone https://github.com/rom-rb/rom.git
cd rom/core
bundle install
createdb rom
ruby benchmarks/basic_bench.rb
ruby benchmarks/basic_bench.rb --jit
=> benchmark: Loading ONE user object
Warming up --------------------------------------
AR 218.000 i/100ms
ROM 208.000 i/100ms
Calculating -------------------------------------
AR 1.956k (±12.5%) i/s - 9.810k in 5.100876s
ROM 1.752k (±12.4%) i/s - 8.736k in 5.069564s
Comparison:
AR: 1956.1 i/s
ROM: 1751.6 i/s - same-ish: difference falls within error
********************************************************************************
=> benchmark: Loading ALL user objects
Warming up --------------------------------------
AR 10.000 i/100ms
ROM 18.000 i/100ms
ROM (auto_struct: false)
39.000 i/100ms
Calculating -------------------------------------
AR 95.518 (±14.7%) i/s - 470.000 in 5.036378s
ROM 170.181 (± 8.2%) i/s - 864.000 in 5.112447s
ROM (auto_struct: false)
381.107 (± 6.6%) i/s - 1.911k in 5.038414s
Comparison:
ROM (auto_struct: false): 381.1 i/s
ROM: 170.2 i/s - 2.24x slower
AR: 95.5 i/s - 3.99x slower
********************************************************************************
=> benchmark: Loading ALL users with their tasks
Warming up --------------------------------------
AR 1.000 i/100ms
ROM 2.000 i/100ms
Calculating -------------------------------------
AR 12.873 (± 7.8%) i/s - 65.000 in 5.068391s
ROM
27.414 (± 7.3%) i/s - 138.000 in 5.062297s
Comparison:
ROM: 27.4 i/s
AR: 12.9 i/s - 2.13x slower
********************************************************************************
=> benchmark: Loading 3000 posts with their users
Warming up --------------------------------------
AR 1.000 i/100ms
ROM 1.000 i/100ms
Calculating -------------------------------------
AR 1.863 (± 0.0%) i/s - 10.000 in 5.372916s
ROM 6.402 (±15.6%) i/s - 32.000 in 5.093117s
Comparison:
ROM: 6.4 i/s
AR: 1.9 i/s - 3.44x slower
********************************************************************************
=> benchmark: Loading 20 posts with their users
Warming up --------------------------------------
AR 12.000 i/100ms
ROM 28.000 i/100ms
Calculating -------------------------------------
AR 136.307 (± 4.4%) i/s - 684.000 in 5.026858s
ROM 269.586 (± 7.8%) i/s - 1.344k in 5.018948s
Comparison:
ROM: 269.6 i/s
AR: 136.3 i/s - 1.98x slower
********************************************************************************
=> benchmark: Loading ALL users with their tasks with 20 limit
Warming up --------------------------------------
AR 34.000 i/100ms
ROM 48.000 i/100ms
Calculating -------------------------------------
AR 325.826 (± 9.2%) i/s - 1.632k in 5.056360s
ROM 478.930 (± 8.4%) i/s - 2.400k in 5.061437s
Comparison:
ROM: 478.9 i/s
AR: 325.8 i/s - 1.47x slower
********************************************************************************
=> benchmark: Loading ALL users with their tasks and their tags
Warming up --------------------------------------
AR 1.000 i/100ms
ROM 1.000 i/100ms
Calculating -------------------------------------
AR 2.936 (± 0.0%) i/s - 15.000 in 5.144115s
ROM 5.873 (±17.0%) i/s - 29.000 in 5.022658s
Comparison:
ROM: 5.9 i/s
AR: 2.9 i/s - 2.00x slower
********************************************************************************
=> benchmark: Loading ONE task with its user and tags
Warming up --------------------------------------
AR 34.000 i/100ms
ROM 41.000 i/100ms
Calculating -------------------------------------
AR 389.776 (± 8.2%) i/s - 1.938k in 5.011961s
ROM 446.909 (± 9.8%) i/s - 2.255k in 5.102297s
Comparison:
ROM: 446.9 i/s
AR: 389.8 i/s - same-ish: difference falls within error
********************************************************************************
=> benchmark: Loading ALL tasks with their users
Warming up --------------------------------------
AR 1.000 i/100ms
ROM[wrap] 1.000 i/100ms
ROM[combine] 1.000 i/100ms
Calculating -------------------------------------
AR 12.206 (± 8.2%) i/s - 61.000 in 5.055967s
ROM[wrap] 15.987 (±12.5%) i/s - 79.000 in 5.010093s
ROM[combine] 19.064 (±10.5%) i/s - 94.000 in 5.017712s
Comparison:
ROM[combine]: 19.1 i/s
ROM[wrap]: 16.0 i/s - same-ish: difference falls within error
AR: 12.2 i/s - 1.56x slower
********************************************************************************
=> benchmark: Loading ALL tasks with their users and tags
Warming up --------------------------------------
AR 1.000 i/100ms
ROM 1.000 i/100ms
Calculating -------------------------------------
AR 2.741 (± 0.0%) i/s - 14.000 in 5.112967s
ROM 4.589 (± 0.0%) i/s - 23.000 in 5.039191s
Comparison:
ROM: 4.6 i/s
AR: 2.7 i/s - 1.67x slower
********************************************************************************
=> benchmark: to_json on ALL user objects
Warming up --------------------------------------
AR 2.000 i/100ms
ROM 4.000 i/100ms
Calculating -------------------------------------
AR 25.033 (± 8.0%) i/s - 124.000 in 5.000034s
ROM 47.249 (± 8.5%) i/s - 236.000 in 5.032716s
Comparison:
ROM: 47.2 i/s
AR: 25.0 i/s - 1.89x slower
********************************************************************************
=> benchmark: Loading ONE user object
Warming up --------------------------------------
AR 211.000 i/100ms
ROM 214.000 i/100ms
Calculating -------------------------------------
AR 2.263k (± 7.8%) i/s - 11.605k in 5.179217s
ROM 2.249k (± 5.0%) i/s - 11.342k in 5.054951s
Comparison:
AR: 2263.4 i/s
ROM: 2249.3 i/s - same-ish: difference falls within error
********************************************************************************
=> benchmark: Loading ALL user objects
Warming up --------------------------------------
AR 11.000 i/100ms
ROM 18.000 i/100ms
ROM (auto_struct: false)
41.000 i/100ms
Calculating -------------------------------------
AR 109.793 (± 8.2%) i/s - 550.000 in 5.041807s
ROM 186.267 (± 7.5%) i/s - 936.000 in 5.055381s
ROM (auto_struct: false)
417.830 (± 4.5%) i/s - 2.091k in 5.014299s
Comparison:
ROM (auto_struct: false): 417.8 i/s
ROM: 186.3 i/s - 2.24x slower
AR: 109.8 i/s - 3.81x slower
********************************************************************************
=> benchmark: Loading ALL users with their tasks
Warming up --------------------------------------
AR 1.000 i/100ms
ROM 3.000 i/100ms
Calculating -------------------------------------
AR 14.480 (± 6.9%) i/s - 73.000 in 5.056600s
ROM 33.472 (± 6.0%) i/s - 168.000 in 5.033757s
Comparison:
ROM: 33.5 i/s
AR: 14.5 i/s - 2.31x slower
********************************************************************************
=> benchmark: Loading 3000 posts with their users
Warming up --------------------------------------
AR 1.000 i/100ms
ROM 1.000 i/100ms
Calculating -------------------------------------
AR 2.151 (± 0.0%) i/s - 11.000 in 5.130323s
ROM 7.114 (± 0.0%) i/s - 36.000 in 5.076371s
Comparison:
ROM: 7.1 i/s
AR: 2.2 i/s - 3.31x slower
********************************************************************************
=> benchmark: Loading 20 posts with their users
Warming up --------------------------------------
AR 14.000 i/100ms
ROM 29.000 i/100ms
Calculating -------------------------------------
AR 146.010 (± 4.8%) i/s - 742.000 in 5.095133s
ROM 290.306 (± 3.4%) i/s - 1.450k in 5.001214s
Comparison:
ROM: 290.3 i/s
AR: 146.0 i/s - 1.99x slower
********************************************************************************
=> benchmark: Loading ALL users with their tasks with 20 limit
Warming up --------------------------------------
AR 38.000 i/100ms
ROM 53.000 i/100ms
Calculating -------------------------------------
AR 366.417 (± 6.5%) i/s - 1.862k in 5.106210s
ROM 521.151 (± 5.0%) i/s - 2.650k in 5.100339s
Comparison:
ROM: 521.2 i/s
AR: 366.4 i/s - 1.42x slower
********************************************************************************
=> benchmark: Loading ALL users with their tasks and their tags
Warming up --------------------------------------
AR 1.000 i/100ms
ROM 1.000 i/100ms
Calculating -------------------------------------
AR 3.295 (± 0.0%) i/s - 17.000 in 5.179673s
ROM 5.032 (± 0.0%) i/s - 26.000 in 5.193284s
Comparison:
ROM: 5.0 i/s
AR: 3.3 i/s - 1.53x slower
********************************************************************************
=> benchmark: Loading ONE task with its user and tags
Warming up --------------------------------------
AR 36.000 i/100ms
ROM 50.000 i/100ms
Calculating -------------------------------------
AR 432.726 (± 7.9%) i/s - 2.160k in 5.034918s
ROM 458.958 (±15.7%) i/s - 2.250k in 5.065643s
Comparison:
ROM: 459.0 i/s
AR: 432.7 i/s - same-ish: difference falls within error
********************************************************************************
=> benchmark: Loading ALL tasks with their users
Warming up --------------------------------------
AR 1.000 i/100ms
ROM[wrap] 1.000 i/100ms
ROM[combine] 2.000 i/100ms
Calculating -------------------------------------
AR 13.043 (± 7.7%) i/s - 65.000 in 5.011772s
ROM[wrap] 16.804 (±17.9%) i/s - 82.000 in 5.014001s
ROM[combine] 19.904 (±15.1%) i/s - 100.000 in 5.112968s
Comparison:
ROM[combine]: 19.9 i/s
ROM[wrap]: 16.8 i/s - same-ish: difference falls within error
AR: 13.0 i/s - 1.53x slower
********************************************************************************
=> benchmark: Loading ALL tasks with their users and tags
Warming up --------------------------------------
AR 1.000 i/100ms
ROM 1.000 i/100ms
Calculating -------------------------------------
AR 3.095 (± 0.0%) i/s - 16.000 in 5.214557s
ROM 6.214 (± 0.0%) i/s - 32.000 in 5.163702s
Comparison:
ROM: 6.2 i/s
AR: 3.1 i/s - 2.01x slower
********************************************************************************
=> benchmark: to_json on ALL user objects
Warming up --------------------------------------
AR 2.000 i/100ms
ROM 5.000 i/100ms
Calculating -------------------------------------
AR 26.785 (± 7.5%) i/s - 134.000 in 5.043251s
ROM 47.741 (±12.6%) i/s - 240.000 in 5.111565s
Comparison:
ROM: 47.7 i/s
AR: 26.8 i/s - 1.78x slower
********************************************************************************
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment