Skip to content

Instantly share code, notes, and snippets.

@havenwood
Created September 19, 2018 01:09
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/e0ac0fec4b53143603b687530d818175 to your computer and use it in GitHub Desktop.
Save havenwood/e0ac0fec4b53143603b687530d818175 to your computer and use it in GitHub Desktop.
Calculating -------------------------------------
5 chained 631.600k (± 4.7%) i/s - 3.199M in 5.077472s
5 single 494.294k (± 4.6%) i/s - 2.480M in 5.029235s
Comparison:
5 chained: 631600.1 i/s
5 single: 494294.0 i/s - 1.28x slower
Calculating -------------------------------------
1,000 chained 626.506k (± 4.3%) i/s - 3.173M in 5.074975s
1,000 single 494.182k (± 4.7%) i/s - 2.472M in 5.014008s
Comparison:
1,000 chained: 626505.6 i/s
1,000 single: 494181.9 i/s - 1.27x slower
Calculating -------------------------------------
100,000 chained 4.408k (± 7.1%) i/s - 22.048k in 5.027531s
100,000 single 2.479k (± 8.2%) i/s - 12.528k in 5.090002s
Comparison:
100,000 chained: 4408.5 i/s
100,000 single: 2478.8 i/s - 1.78x slower
def low_answers_for_question(question)
answers.select(&for_question(question)).select(&:low?)
end
def low_answers_for_question_one_iteration(question)
answers.select do |answer|
for_question(question) && answer.low?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment