Re:Never create Ruby strings longer than 23 characters
by jokoon on Wednesday December 11, 2013 @10:48AM
(#6888173)
"never use ruby" works well for me
[ Parent
| on HN ]
Re:Never create Ruby strings longer than 23 characters
by ctrager on Wednesday December 11, 2013 @11:34AM
(#6888516)
The designer of a string class in any language. C++ and Java - has to deal with the same issue - that heap allocations are slower than stack allocations. But to do a stack allocation means reserving some fixed length memory which is a waste if you have a lot of small strings. It's a tradeoff. The Ruby approach is reasonable. I think in Microsoft's C++ STL library, the limit is 16 rather than 32. Even with the low-level closer-to-the-metal power of C/C++, the string class designer still has to make a decision about the tradeoff.