ParparVM Adds Compact Strings to Cut Character Storage Up to 50 Percent

Pull request #5421 introduces compact string support in ParparVM, the virtual machine used by the open-source Codename One cross-platform framework. Previously, every Java String was backed by a char[] array, consuming two bytes per character even for text that only requires one byte. The update follows the approach of Java's JEP 254, storing Latin-1 strings in a byte[] and wider-character strings in a char[], using a single Object field as the backing reference to avoid memory overhead. To preserve ParparVM's fused allocation optimization — which co-locates a String and its backing array in one memory block — the translator was updated to handle the new Object-typed field as a special case. The change halves character-array storage for Latin-1 strings, with the greatest savings on longer strings, while native operations and common concatenation patterns were also updated to work directly with the compact format.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in