Skip to content

improve performance of property reordering during feature decoding#561

Merged
azahnen merged 2 commits into
masterfrom
cache-positions
Jul 10, 2026
Merged

improve performance of property reordering during feature decoding#561
azahnen merged 2 commits into
masterfrom
cache-positions

Conversation

@cportele

Copy link
Copy Markdown
Contributor

The schema-order reordering pass sorted each object's children with a comparator that re-resolved a node's schema position on every comparison, and the coalesce step resolved it again two or three times per child, so the per-path lookup ran O(n log n) times for a node with n children.

Cache the resolved position on the node - computed once per reordering pass, where the mapping is constant - so each node is resolved at most once. Output is unchanged.

The schema-order reordering pass sorted each object's children with a
comparator that re-resolved a node's schema position on every comparison,
and the coalesce step resolved it again two or three times per child, so
the per-path lookup ran O(n log n) times for a node with n children.

Cache the resolved position on the node - computed once per reordering
pass, where the mapping is constant - so each node is resolved at most
once. Output is unchanged.
@cportele cportele requested a review from azahnen as a code owner June 29, 2026 11:38
@azahnen azahnen enabled auto-merge (squash) July 10, 2026 10:10
@azahnen azahnen merged commit 081ae63 into master Jul 10, 2026
3 checks passed
@azahnen azahnen deleted the cache-positions branch July 10, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants