r/Protos • u/guillermoamolina • 7h ago
Removing repeated Unicode prefix scans with TruffleString and specialized bytecode
Unicode scalar indexing should not require scanning a string from the beginning on every access.
Core String now uses immutable TruffleString storage with canonical UTF-32 logical encoding, allowing compact physical representations where appropriate.
The existing Bytecode DSL specializes indexing, length, concatenation, equality, hashing and iteration while preserving dynamic message semantics and overridden operations.
The change passed all 20 jobs of exhaustive pull-request validation, including Native Image.
An interesting runtime design question: how much string-specific optimization can remain inside the execution engine without compromising dynamic language semantics?
Website: https://protoslang.com
Source: https://github.com/guillermomolina/protos
Implementation: https://github.com/guillermomolina/protos/pull/1297