Fast Ruby – A collection of common Ruby idioms
1–10 of 27 posts
Re: Fast Ruby – A collection of common Ruby idioms
#2Shouldn't some of those items be opened as a ticket to Ruby 2.x and standard library to ask them for a faster implementation?
Re: Fast Ruby – A collection of common Ruby idioms
#3Good read!
Re: Fast Ruby – A collection of common Ruby idioms
#4Shouldn't some of those items be opened as a ticket to Ruby 2.x and standard library to ask them for a faster implementation?
Yes a lot of these can be solved - JRuby+Truffle for example removes the overhead of at least parallel assignment vs normal assignment, define_method vs def, send vs normal send, Proc#call vs yield.
Some of the others though, such as Array#bsearch vs Array#find, are just algorithmic complexity and not the fault of the implementation.
Re: Fast Ruby – A collection of common Ruby idioms
#5I'm surprised at the speed difference between parallel and sequential assignment styles. I prefer the sequential, so that's a nice bonus that it's also more performant.
Re: Fast Ruby – A collection of common Ruby idioms
#6Awesome comparisons. Extremely good to know. Would love Rubinius on Linux, and comma delimited or underscore delimited results. Maybe I'll run an post those that way.
Re: Fast Ruby – A collection of common Ruby idioms
#7Really nice project, and there's a lot to learn from it.
But I think if your choice is ruby then you are putting clean code above micro optimizations. And it often pays off.
Re: Fast Ruby – A collection of common Ruby idioms
#8I would advise against concluding anything with < 20% gain, the changes often impacts readability (the intention becomes less clear) and might as well be measurement errors or just be insignificant for any sort of real application.
Not to mention, of course, these measurements are specific to a given system, implementation, etc.
Re: Fast Ruby – A collection of common Ruby idioms
#9Really nice project, and there's a lot to learn from it. But I think if your choice is ruby then you are putting clean code above micro optimizations. And it often pays off.
[deleted]
Re: Fast Ruby – A collection of common Ruby idioms
#10Really nice project, and there's a lot to learn from it. But I think if your choice is ruby then you are putting clean code above micro optimizations. And it often pays off.
Most examples aren't really about micro-optimizations. They're more about calling the appropriate method in the first place (count vs. size/length, gsub vs. sub/tr).