4 ms·
Thank you, this was great! Both my work and side projects all run on Ruby (except the ones that run on js), and this has been extremely helpful. I actually wrot
by ffn 12y ago
Thank you, this was great! Both my work and side projects all run on Ruby (except the ones that run on js), and this has been extremely helpful. I actually wrote def(whatever, &block) ... all the time because I was told that it would be clearer that a block was needed, but if just dropping the &block means I can get a 4x speed upgrade... well, time for a bit of refactoring in various critical loop sections.
- knodi123 12y ago> if just dropping the &block means I can get a 4x speed upgrade Well, up to 4x. If you're doing anything interesting or complex, or, god forbid, making a database call, then this might turn into an instance of that famous anecdote where Bill Gates wouldn't even bend over to pick up a thousand dollars laying on the ground.
- stormbrew 12y agoThis can't be emphasized enough. Do almost anything worth doing in that function or in the block itself and the 400% improvement on the 1% of that functions execution time becomes almost certainly meaningless. These kinds of performance improvements have very steep diminishing returns.