Re:JEP254: proposal to represent Java Strings as ISO-8859-1
by Skinney on Friday May 15, 2015 @08:18AM
(#9550086)
Reducing memory usage also reduces time spent in garbage collection.
Re:JEP254: proposal to represent Java Strings as ISO-8859-1
by Skinney on Friday May 15, 2015 @08:31AM
(#9550129)
Why 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.
Re:JEP254: proposal to represent Java Strings as ISO-8859-1
by aardvark179 on Friday May 15, 2015 @09:17AM
(#9550331)
And the more you can allocate in a thread local allocation buffer before your bump allocator has to request a new TLAB.
Re:JEP254: proposal to represent Java Strings as ISO-8859-1
by blibble on Friday May 15, 2015 @02:01PM
(#9552406)
I 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)
Re:JEP254: proposal to represent Java Strings as ISO-8859-1
by Skinney on Friday May 15, 2015 @07:12PM
(#9554237)
Larger 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.
Re:JEP254: proposal to represent Java Strings as ISO-8859-1
by tmd83 on Friday May 15, 2015 @08:42AM
(#9550169)
The 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.
Re:JEP254: proposal to represent Java Strings as ISO-8859-1
by zokier on Friday May 15, 2015 @10:08AM
(#9550641)
Umm.. This will be completely transparent to developers, strings will fall back to Javas weirdo UCS2/UTF16 when necessary automatically.
Re:JEP254: proposal to represent Java Strings as ISO-8859-1
by guard-of-terra on Friday May 15, 2015 @11:45AM
(#9551338)
This 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)
Re:JEP254: proposal to represent Java Strings as ISO-8859-1
by cesarb on Friday May 15, 2015 @12:42PM
(#9551805)
Aren't Java Strings immutable? Once built, they won't be modified.
Re:JEP254: proposal to represent Java Strings as ISO-8859-1
by guard-of-terra on Friday May 15, 2015 @03:58PM
(#9553256)
You still need t construct them from e.g. array of bytes.
Memory is dirt cheap these days anyway, why now? And if you have mounds of text, compress it.