The optimization of reusing the character array for a string was used in Java until roughly the Java 7 days, when it was dropped because it could cause a space leak: <a href="https://stackoverflow.com/questions/15612157/substring-method-in-string-class-causes-memory-leak#15612188" rel="nofollow">https://stackoverflow.com/questions/15612157/substring-metho...</a>.<p>One difference in Java was that you could slice out the middle of a string (you just kept the start and end of the array, iirc). I wonder if that difference makes this approach workable for Ruby, or if that implies that one team made a mistake.
Aaron is my personal career idol. I love seeing his work come up on here, it gives me a view in to the deeper workings of ruby that are years beyond my expertise, but in a way that I can mostly grok what's going on. I'm super happy github hired him to hack around on ruby.<p>Also, his talks are excellent; his closing keynote for RailsConf in particular seems worth recommending, as it was about his work speeding up Rails using kind of similar string optimizations/caching:<p><a href="https://www.youtube.com/watch?v=BTTygyxuGj8" rel="nofollow">https://www.youtube.com/watch?v=BTTygyxuGj8</a>
Object allocations really are a big deal with Ruby. My Ruby compiler project has been really slow moving again over the last year, but as far as I can tell the current main hurdle is a basic garbage collector, as even adding various object caching, I actually exhaust the 2GB heap (the compiler was started when i386 was a reasonable initial architecture choice...)...<p>Granted that's worse that it'd be for MRI, as it includes allocating actual objects even for Fixnum and Symbol (MRI uses tagged values for both and just pretend they're "real" objects), though I added caching for both that cut hundred of thousands of allocations..
Kinda suprised when I see title like that on HN that not so many people are talking about Crystal <a href="https://crystal-lang.org" rel="nofollow">https://crystal-lang.org</a>. Basically Ruby with C performances.<p>So far I’ve been more convinced by Crystal than Elixir as the next language for a Ruby developer.