Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungBreeze TTS 2 vs ElevenLabs: Open Source TTS Verdict(23.09.2026 um 05:44 Uhr)
Sichere ProgrammierungAgentic AI vs Generative AI: The 2026 Verdict(23.09.2026 um 05:44 Uhr)
Sichere ProgrammierungI made my agent prove every quote against the source document(23.09.2026 um 05:45 Uhr)
Sichere Programmierung8mb.video Alternative: Skip the Line, Skip the Upsell(23.09.2026 um 05:47 Uhr)
Sichere ProgrammierungBuilding a GTA 6 JSON API for entities and current status(23.09.2026 um 05:52 Uhr)
Sichere ProgrammierungEvery filter needs a documented exception(23.09.2026 um 06:01 Uhr)
Sichere ProgrammierungBreeze TTS 2 vs ElevenLabs: Open Source TTS Verdict(23.09.2026 um 05:44 Uhr)
Sichere ProgrammierungAgentic AI vs Generative AI: The 2026 Verdict(23.09.2026 um 05:44 Uhr)
Sichere ProgrammierungI made my agent prove every quote against the source document(23.09.2026 um 05:45 Uhr)
Sichere Programmierung8mb.video Alternative: Skip the Line, Skip the Upsell(23.09.2026 um 05:47 Uhr)
Sichere ProgrammierungBuilding a GTA 6 JSON API for entities and current status(23.09.2026 um 05:52 Uhr)
Sichere ProgrammierungEvery filter needs a documented exception(23.09.2026 um 06:01 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Compact Strings Cut Character Storage in Half

PR #5421 adds compact strings to ParparVM. Strings that fit in Latin-1 now use a byte[]; strings that need wider code units continue to use char[]. What is Codename One? Codename One is an open-source framework for building native iOS,…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Compact Strings Cut Character Storage in Half



PR #5421 adds compact strings to ParparVM. Strings that fit in Latin-1 now use a byte[]; strings that need wider code units continue to use char[].



What is Codename One? Codename One is an open-source framework for building native iOS, Android, desktop, and web apps from a single Java or Kotlin codebase. Learn more at codenameone.com.



ParparVM previously stored every Java String in a char[]. Class names, JSON keys, URLs, numbers, log messages, and much Western European text therefore used two bytes per code unit when one byte was enough.



The implementation follows the basic approach in JEP 254 for modern HotSpot. ParparVM also had to preserve fused allocation without adding another pointer to every string.






One field, two possible array types



Using one field for each array type would add a second reference to every string:




// We did not do this.
private byte[] latin1Value;
private char[] utf16Value;






Every string would pay for two references even though one is always null. On a heap full of short strings, that fixed cost can erase a meaningful part of the saving.



The actual shape keeps one backing reference:




@Fused
public final class String {
// Holds either byte[] for Latin-1 or char[] for UTF-16.
private Object value;
private final int offset;
private final int count;

private char charInternal(int i) {
Object v = value;
return v instanceof byte[]
? (char) (((byte[]) v)[offset + i] & 0xff)
: ((char[]) v)[offset + i];
}
}






The concrete array type is the encoding marker. There is no second array reference and no separate coder field.



Diagram



This does not halve the complete memory cost of every String. Object headers, the one backing reference, and the other fields remain. It halves the character-array storage when the value fits in Latin-1. Short strings save less in absolute terms; long Latin-1 strings approach the full 50 percent backing-store reduction.






Fused allocation made the layout harder



ParparVM can mark a class with @Fused. When the translator recognizes a suitable constructor, it allocates the owner and its child array in one BiBOP block. A String and its backing array can therefore need one allocation instead of two.



Before compact strings, the translator knew that String.value was a char[]. Changing the field to Object hid the child array type from the ordinary descriptor check. Dropping fusion would have kept the code simple, but it would have traded away an existing allocation and locality optimization on one of the most frequently created objects in a Java application.



The translator now handles String.value as a narrow special case. It accepts only a freshly created byte[] or char[], sizes the fused block for that concrete element type, and installs that array in the same value slot.



Diagram



There is a garbage-collector constraint here too. The backing array must be initialized before the fused object becomes visible to the concurrent collector. A half-built string is not merely a performance bug; it can become a bad heap edge.






String operations keep the compact representation



Native string operations identify the backing array once and keep that check outside their character loops. They do not convert compact strings to char[] for each operation.



Numeric conversion has a direct Latin-1 path because decimal digits are known to fit. Common concatenation shapes with two to five string parts are lowered to helpers that first determine the result representation, allocate the result once, and fill it directly:




String path = "users/" + userId + "/settings";






When every part is already Latin-1, that result stays compact. If any part needs a wider code unit, the result uses char[].



Hand-written native code needed attention as well. Code that previously cast String.value directly to char[] had to go through coder-aware access. That audit matters because Java-level tests can pass while an old native cast quietly reads the wrong array layout.






Unicode still takes the correct path



Latin-1 covers code points from 0 through 255. It does not cover Hebrew, Arabic, most Asian scripts, emoji, or the rest of Unicode.



Those strings continue to use char[]:




String compact = "Résumé 2026"; // Latin-1: byte[] backing
String wide = "שלום"; // outside Latin-1: char[] backing






The representation changes storage inside the VM, not the supported character set. length(), charAt(), comparison, hashing, substring operations, encoding, and native interop retain their Java behavior.



Application code does not change. Latin-1 strings use less backing storage and remain compatible with fused allocation, native string operations, and the concurrent collector.



Start the release series with the free and open-source JavaScript port, or read about calendar synchronization, Bluetooth support, pure Codename One text editing, and lightweight rich text.

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-18163 | IBM Financial Transaction Manager (FTM) for RedHat OpenShift could allow…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick