Hacker News new | ask | show | jobs
by vidarh 4566 days ago
It would be a tremendous waste of memory, as a large percently of strings are small. It would also be a massive slowdown for any situations where you are copying a big string unchanged (in which case Ruby "just" marks the string as "copy on write") or where you are copying a small string.

As for slowness, there are many, many obvious targets much higher up the list than String. Slow method dispatch being the primary culprit.

1 comments

I feel you..... I was more wondering if there was some better compromise point between pre-allocated / dynamic but as you say, there are tradeoffs.

You're right, there must be a lot more low-hanging fruit out there. Something interesting though... isn't the Ruby interpreter just a standard (RubySpec)? JRuby (and Rubinius I think?) are other, better-performing implementations, correct? I've been thinking about trying JRuby since I was looking into Grails and thought "eh why not just try JRuby on Rails".

but i've kinda gone in the other direction anyway and am more interested in Clojure > Ruby, especially since Clojure "frameworks" are just dead simple libs. It's weird because RoR was around first (I think, maybe some overlap in development...) but it seems that now that Clojure and Scala exist, RoR is kindof like a bad compromise between the two.

Though Clojure is kindof minimal and not everyone is singing Scala's praises...