Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
benchmarking Array#all? #none? #one? (vs old implementation Enumerator#all?, etc)
**********************************************************************************
benchmarking Array#all?
**********************************************************************************
Calculating -------------------------------------
Array#all? (new) 421.298 i/s - 1.000k times in 2.373616s (2.37ms/i)
Array#all? (old) 335.364 i/s - 1.000k times in 2.981838s (2.98ms/i)
Comparison:
Array#all? (new): 421.3 i/s
Array#all? (old): 335.4 i/s - 1.26x slower
<running with --jit>
Calculating -------------------------------------
Array#all? (new) 244.929 i/s - 1.000k times in 4.082823s (4.08ms/i)
Array#all? (old) 210.354 i/s - 1.000k times in 4.753895s (4.75ms/i)
Comparison:
Array#all? (new): 244.9 i/s
Array#all? (old): 210.4 i/s - 1.16x slower
**********************************************************************************
benchmarking Array#none?
**********************************************************************************
Calculating -------------------------------------
Array#none? (new) 367.652 i/s - 1.000k times in 2.719965s (2.72ms/i)
Array#none? (old) 349.266 i/s - 1.000k times in 2.863144s (2.86ms/i)
Comparison:
Array#none? (new): 367.7 i/s
Array#none? (old): 349.3 i/s - 1.05x slower
<running with --jit>
Calculating -------------------------------------
Array#none? (new) 347.234 i/s - 1.000k times in 2.879904s (2.88ms/i)
Array#none? (old) 205.024 i/s - 1.000k times in 4.877467s (4.88ms/i)
Comparison:
Array#none? (new): 347.2 i/s
Array#none? (old): 205.0 i/s - 1.69x slower
**********************************************************************************
benchmarking Array#one?
**********************************************************************************
Calculating -------------------------------------
Array#one? (new) 193.948 i/s - 1.000k times in 5.156011s (5.16ms/i)
Array#one? (old) 173.020 i/s - 1.000k times in 5.779695s (5.78ms/i)
Comparison:
Array#one? (new): 193.9 i/s
Array#one? (old): 173.0 i/s - 1.12x slower
<running with --jit>
Calculating -------------------------------------
Array#one? (new) 137.804 i/s - 1.000k times in 7.256689s (7.26ms/i)
Array#one? (old) 108.508 i/s - 1.000k times in 9.215937s (9.22ms/i)
Comparison:
Array#one? (new): 137.8 i/s
Array#one? (old): 108.5 i/s - 1.27x slower
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.