Affected function
FindChildFast in package/JSON.cls.
Problem
Each object-key lookup scans direct siblings. It is O(c) in the usual case and O(c x k) in the worst case, where c is the number of fields and k is key length.
Repeated calls such as StringKey, NumberKey, BoolKey, and ExistsKey against wide objects rescan the same fields.
Proposal
Build a normalized key-to-token-id index lazily for a container after repeated lookup, or expose an explicit indexing API. The implementation should not add a mandatory reference; a private open-addressing table or late-bound dictionary are possible designs.
Acceptance criteria
- First lookup keeps the present low-allocation behavior.
- Indexed repeated lookup is expected
O(1).
- Duplicate-key behavior is defined and tested.
- Index lifetime is bound to the parsed document and does not change public API results.
Affected function
FindChildFastinpackage/JSON.cls.Problem
Each object-key lookup scans direct siblings. It is
O(c)in the usual case andO(c x k)in the worst case, wherecis the number of fields andkis key length.Repeated calls such as
StringKey,NumberKey,BoolKey, andExistsKeyagainst wide objects rescan the same fields.Proposal
Build a normalized key-to-token-id index lazily for a container after repeated lookup, or expose an explicit indexing API. The implementation should not add a mandatory reference; a private open-addressing table or late-bound dictionary are possible designs.
Acceptance criteria
O(1).