fast-ruby icon indicating copy to clipboard operation
fast-ruby copied to clipboard

Compare one n-element hash#merge! vs n assignments with []=

Open ohaleck opened this issue 4 years ago • 0 comments

The code/hash/merge-bang-vs-[]=.rb benchmark merges N 1-element hashes to compare it with N hash element assignments using []=. Obviously assignments are faster, but this is not a real-life scenario.

The more common case would be to perform one merge an N-element hash and it appears it is much faster to do it than to perform N assignments. This PR implements such a benchmark.

ohaleck avatar Dec 02 '21 14:12 ohaleck