Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lovitt
Last active May 18, 2017 22:21
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 lovitt/273e8badd58b6ccf8c71cd0e7feaa50c to your computer and use it in GitHub Desktop.
Save lovitt/273e8badd58b6ccf8c71cd0e7feaa50c to your computer and use it in GitHub Desktop.
AR init benchmarks for Rails 5.1.1 vs patched. See: https://gist.github.com/lovitt/b5edf05d11ef2571582c32d7547c1243
================== Instantiate STI base class with attributes ==================
Warming up --------------------------------------
v5.1.1 834.000 i/100ms
patched 1.655k i/100ms
Calculating -------------------------------------
v5.1.1 8.317k (±16.9%) i/s - 40.032k in 5.067138s
patched 16.522k (± 6.1%) i/s - 82.750k in 5.026913s
Comparison:
patched: 16522.1 i/s
v5.1.1: 8317.0 i/s - 1.99x slower
================ Instantiate STI base class without attributes =================
Warming up --------------------------------------
v5.1.1 951.000 i/100ms
patched 2.112k i/100ms
Calculating -------------------------------------
v5.1.1 9.916k (±19.0%) i/s - 47.550k in 5.124357s
patched 20.641k (± 5.3%) i/s - 103.488k in 5.028540s
Comparison:
patched: 20641.2 i/s
v5.1.1: 9916.0 i/s - 2.08x slower
================= Instantiate STI subclass via type attribute ==================
Warming up --------------------------------------
v5.1.1 1.028k i/100ms
patched 1.319k i/100ms
Calculating -------------------------------------
v5.1.1 10.143k (± 8.2%) i/s - 50.372k in 5.015323s
patched 12.580k (± 6.3%) i/s - 63.312k in 5.053136s
Comparison:
patched: 12579.5 i/s
v5.1.1: 10143.0 i/s - 1.24x slower
=================== Instantiate STI subclass with attributes ===================
Warming up --------------------------------------
v5.1.1 1.305k i/100ms
patched 1.673k i/100ms
Calculating -------------------------------------
v5.1.1 12.811k (±10.2%) i/s - 63.945k in 5.064926s
patched 16.324k (± 8.5%) i/s - 81.977k in 5.058501s
Comparison:
patched: 16324.2 i/s
v5.1.1: 12810.9 i/s - 1.27x slower
================= Instantiate STI subclass without attributes ==================
Warming up --------------------------------------
v5.1.1 1.703k i/100ms
patched 2.108k i/100ms
Calculating -------------------------------------
v5.1.1 16.174k (±18.9%) i/s - 76.635k in 5.033934s
patched 21.405k (± 6.8%) i/s - 107.508k in 5.045254s
Comparison:
patched: 21404.9 i/s
v5.1.1: 16173.9 i/s - 1.32x slower
================== Instantiate Non-STI class with attributes ===================
Warming up --------------------------------------
v5.1.1 1.607k i/100ms
patched 1.891k i/100ms
Calculating -------------------------------------
v5.1.1 16.283k (±14.8%) i/s - 78.743k in 5.042009s
patched 19.997k (± 5.7%) i/s - 100.223k in 5.028268s
Comparison:
patched: 19997.0 i/s
v5.1.1: 16283.3 i/s - 1.23x slower
================= Instantiate Non-STI class without attributes =================
Warming up --------------------------------------
v5.1.1 1.945k i/100ms
patched 2.573k i/100ms
Calculating -------------------------------------
v5.1.1 20.723k (±17.6%) i/s - 99.195k in 5.074382s
patched 27.071k (± 9.7%) i/s - 133.796k in 5.003985s
Comparison:
patched: 27071.0 i/s
v5.1.1: 20723.3 i/s - 1.31x slower
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment