From 7dc8cc97083e3b7768cc88417c7cc4855a14787f Mon Sep 17 00:00:00 2001 From: Mateus Pereira Date: Mon, 10 Oct 2022 15:52:36 -0300 Subject: [PATCH] Removes the assignments benchmark --- README.md | 22 ---------------------- code/general/assignment.rb | 24 ------------------------ 2 files changed, 46 deletions(-) delete mode 100644 code/general/assignment.rb diff --git a/README.md b/README.md index 1f7b8d1..f6d3362 100644 --- a/README.md +++ b/README.md @@ -56,28 +56,6 @@ Idioms ### General -##### Parallel Assignment vs Sequential Assignment [code](code/general/assignment.rb) - -[Read the rationale here](https://github.com/JuanitoFatas/fast-ruby/pull/50#issue-98586885). - -``` -$ ruby -v code/general/assignment.rb -ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14] - -Calculating ------------------------------------- - Parallel Assignment 149.201k i/100ms -Sequential Assignment - 142.545k i/100ms -------------------------------------------------- - Parallel Assignment 7.687M (± 6.9%) i/s - 38.345M -Sequential Assignment - 6.320M (± 8.5%) i/s - 31.360M - -Comparison: - Parallel Assignment: 7686954.1 i/s -Sequential Assignment: 6320425.6 i/s - 1.22x slower -``` - ##### `attr_accessor` vs `getter and setter` [code](code/general/attr-accessor-vs-getter-and-setter.rb) > https://www.omniref.com/ruby/2.2.0/files/method.h?#annotation=4081781&line=47 diff --git a/code/general/assignment.rb b/code/general/assignment.rb deleted file mode 100644 index b603d86..0000000 --- a/code/general/assignment.rb +++ /dev/null @@ -1,24 +0,0 @@ -require 'benchmark/ips' - -def fast - _a, _b, _c, _d, _e, _f, _g, _h = 1, 2, 3, 4, 5, 6, 7, 8 - nil -end - -def slow - _a = 1 - _b = 2 - _c = 3 - _d = 4 - _e = 5 - _f = 6 - _g = 7 - _h = 8 - nil -end - -Benchmark.ips do |x| - x.report('Parallel Assignment') { fast } - x.report('Sequential Assignment') { slow } - x.compare! -end