5 ms·
I genuinely wonder: is the space requirement of text encodings really an important issue in this age of large photo and video content?
by amelius 6y ago
I genuinely wonder: is the space requirement of text encodings really an important issue in this age of large photo and video content?
- astrange 6y agoMemory for strings is often more important because there's a lot more of them, and image memory can be file-backed more often but strings need to be swapped to disk.
- jcranmer 6y agoLooking at my browser's memory reporting, strings take up about ~2-3% of total memory usage, most of which is probably ASCII. If it were UCS-2, that would make it ~5% of total memory usage, and UCS-4 ~10%. That's small numbers, but as a whole-program impact, it's significant enough to motivate performance engineers to actually try to compress those strings down a bit.
- amelius 6y agoIt depends on how strings are counted. If every String object is atomized/interned then e.g. the string "div" is stored once, but on a 64bit system you have 8 bytes for a pointer and another 8 bytes for bookkeeping things such as length.
- FridgeSeal 6y agoIf you ever want to do something stuff with text efficiently (full text search and associated processing) I’d argue that it’s quite important.
- Dylan16807 6y agoIf you want to do search, you need collation, and you can't use any standard encoding for that data.
- rectang 6y agoIt's important to distinguish between sorting in code point order and sorting according what a user would expect for their language. However, sorting in code point order (which is actually equivalent to sorting by memory comparison for UTF-8) is enough to build an inverted index data structure, commonly used for fulltext search. And just like FridgeSeal asserted, the memory footprint of the text representation has performance implications for such an application. (Source: I wrote a search engine library.)
- tsimionescu 6y agoWill that handle things like matching accented and unaccented characters? If I search for 'stefan' in a text that makes frequent references to 'Ștefan', will it correctly find those matches?