hamstergem / hamster

Efficient, Immutable, Thread-Safe Collection classes for Ruby
Other
1.89k stars 94 forks source link

Use yield #232

Open no-reply opened 8 years ago

no-reply commented 8 years ago

This is a follow-up to #189. The Ruby core issue that gave rise to that ticket has been patched since last August. It's probably still worth discussing whether any releases missing the patches should be supported.

In addition to reverting the original patch for #189., this aims to remove unneeded &block parameters throughout.

My benchmark results on bench/hash/each_bench.rb are too variable to say anything too conclusive. Still, I modified the file with b.warmup = 10; b.time = 60, and here are my results. They, at least, point to this making a measurable difference:

On branch use-yield

Warming up --------------------------------------
          each small    44.652k i/100ms
         each medium   113.000  i/100ms
          each large     1.000  i/100ms
Calculating -------------------------------------
          each small    693.754k (± 4.2%) i/s -     41.482M
         each medium      1.095k (± 3.7%) i/s -     65.653k
          each large      1.211  (± 0.0%) i/s -     73.000 

Warming up --------------------------------------
          each small    75.119k i/100ms
         each medium   115.000  i/100ms
          each large     1.000  i/100ms
Calculating -------------------------------------
          each small      1.906M (± 6.4%) i/s -    113.505M
         each medium      1.106k (± 5.6%) i/s -     66.125k
          each large      1.247  (± 0.0%) i/s -     75.000 
Switched to branch 'core'

Warming up --------------------------------------
          each small    44.839k i/100ms
         each medium   120.000  i/100ms
          each large     1.000  i/100ms
Calculating -------------------------------------
          each small    972.978k (± 7.1%) i/s -     57.887M
         each medium      1.255k (± 5.7%) i/s -     75.000k
          each large      1.728  (± 0.0%) i/s -    104.000 

Warming up --------------------------------------
          each small    37.133k i/100ms
         each medium   120.000  i/100ms
          each large     1.000  i/100ms
Calculating -------------------------------------
          each small    579.215k (± 9.8%) i/s -     34.274M
         each medium      1.208k (± 6.0%) i/s -     72.120k
          each large      1.651  (± 0.0%) i/s -     99.000
no-reply commented 8 years ago

This is failing on Rubinius 3.29 in CI. I can't repeat the failure with 3.30 At a glance, this looks like a bug in 3.29.

I can't install 3.29 locally due to LLVM incompatibilities; but might be able to look into it another time. We should evaluate this more thoroughly before moving forward.

alexdowad commented 8 years ago

Personally, I don't care if tests fail on Rubinius. Rubinius is a buggy heap of... bugs.

alexdowad commented 7 years ago

Sorry, what was the motivation for the removal of all occurrences of &block?