3 ms·
Interesting - the last time I looked seriously at Erlang (~2005), its string handling was a mess. Strings were lists of characters, which ate 8 bytes of memory
by nostrademons 10y ago
Interesting - the last time I looked seriously at Erlang (~2005), its string handling was a mess. Strings were lists of characters, which ate 8 bytes of memory per character, couldn't be addressed in O(1), and were often slow to traverse because of cache misses. IOLists seem to be a big improvement on that. They're functionally equivalent to a Rope, right? Ropes are used all over the place at Google (where they're called Cords); I worked on a templating engine while I was there that would just assemble pieces into one for later flushing out to the network.
- kragen 10y agoErlang has always used IO lists for I/O, and they can include both strings and "binaries", i.e. byte arrays. IO lists are very similar to ropes, but because they don't even store the length in each node, they're even faster than ropes to concatenate, but linear-time to index into.