You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Manticore\Ds: typed string array on one byte buffer #271
Manticore\Ds has fixed-width numeric and bit arrays, but no array of strings. A SplFixedArray or Vec of strings stores one cell per element and one refcounted string per cell, so a large list of short strings (tokens, identifiers, path segments) pays a header, a refcount and a pointer per element.
Proposal
A typed string array: all bytes in one contiguous buffer plus an offsets array, so N strings cost two allocations instead of N+1. Open design questions, to settle before code:
Read semantics: $a[$i] materialises a new string (copy) or returns a borrowed view; ownership rules from docs/design/memory-abi.md apply.
Write semantics: replacing an element with a longer string (compaction, gap buffer, or append-only with periodic repack).
Growth, push / pop, indexOf / equals, sort.
Memory-ABI: a new buffer kind in MemoryAbi (layout has one owner), and whether an ABI bump is needed.
Measure first: RSS and iteration time of 1M short strings in array<int,string> / SplFixedArray against a prototype, before committing to the layout.
Acceptance criteria
A measured RSS and time win over array<int,string> on a 1M-string corpus, reported in the PR.
Cases for the Zend-visible semantics (offset rules, exceptions, var_dump, serialize) as for the other Ds arrays.
Activity