Skip to content

Conversation

@dktapps
Copy link
Member

@dktapps dktapps commented Jan 31, 2025

the idea of using linked-list for this was to allow dynamic insertions and deletions midway through the list.

however, this is basically never done in practice, and because SplDoublyLinkedList has O(n) read performance, we pay a read performance penalty for these write features which are basically never used anyway.

in the future, we should perhaps consider getting rid of the mutation APIs from ListTag, and require creating a new ListTag to replace it in mutation cases, similar to other tags (aside from TAG_Compound).

TLDR: This improves performance for the common use-case of ListTag. It also meaningfully improves the performance of ListTag->equals().

the idea of using linked-list for this was to allow dynamic insertions and deletions midway through the list.

however, this is basically never done in practice, and because SplDoublyLinkedList has O(n) read performance,
we pay a read performance penalty for these write features which are basically never used anyway.

in the future, we should perhaps consider getting rid of the mutation APIs from ListTag, and require creating
a new one to replace it in mutation cases, similar to other tags (aside from TAG_Compound).
@dktapps dktapps requested a review from a team as a code owner January 31, 2025 21:01
@dktapps dktapps merged commit 942cc3d into stable Jan 31, 2025
12 checks passed
@dktapps dktapps deleted the list-tag-de-spl branch January 31, 2025 21:11
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.

1 participant