4 ms·
Most of software developers don't care about encodings all day. This will give them enough rope to hang half of the world. Memory is dirt cheap these days anyw
by guard-of-terra 11y ago
Most of software developers don't care about encodings all day. This will give them enough rope to hang half of the world.
Memory is dirt cheap these days anyway, why now? And if you have mounds of text, compress it.
- Skinney 11y agoReducing memory usage also reduces time spent in garbage collection.
- Skinney 11y agoWhy the downvote? The smaller the strings, the more strings you can allocate before triggering a garbage collection. Also, the smaller the objects, the less copying is needed when promoting survivors.
- aardvark179 11y agoAnd the more you can allocate in a thread local allocation buffer before your bump allocator has to request a new TLAB.
- blibble 11y agoI would imagine most of the time would likely be spent traversing the object graph (i.e. chasing references), making it O(number of references) rather than O(allocated size)
- Skinney 11y agoLarger allocations causes the heap to fill up faster, causing garbage collection to happen more often (more traversing the graph). Also, a generational garbage collector like you have in Java will copy survivors to a new heap. The larger the object, the more you will have to copy.
- tmd83 11y agoThe whole idea is that developers wouldn't need to know. Memory might be dirt cheap but GC pause time and surrounding latency definitely is not.
- zokier 11y agoUmm.. This will be completely transparent to developers, strings will fall back to Javas weirdo UCS2/UTF16 when necessary automatically.
- guard-of-terra 11y agoThis might actually be slower (you have a lot of strings which have UCS2 characters down the line, have to reallocate array and copy everything over)
- cesarb 11y agoAren't Java Strings immutable? Once built, they won't be modified.
- guard-of-terra 11y agoYou still need t construct them from e.g. array of bytes.
- Roboprog 11y agoIf I can fit nearly twice as many strings in my L1 / L2 caches, that might help sometimes.