by zeugma · 15y ago · 0 comments
For example, I know of one compiler architecture which scanned strings from the source, all the while calculating a hash, and basically interned the string (turning it into an index per unique string) without ever actually copying it. Thereafter, the program used the index (an integer) to represent the string, making for fast lookups and comparisons.
(Pedanticness: Assuming a few things, like you don't have any references or pointers into the string).