Change from TagTree in choice for Tag array #443
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am still doing some benchmarking and optimizations, and it seems that
TagTree::tag_containstakes a lot time when there are manyChoicetypes in the overall type.It seems to call itself recursively at least once no matter what it contains.
This adds ups since when especially decoding
Choicevariant that is the last in order,tag_containscan be called 1 + amount of variants or even more.So I have tried to replace
TagTreewith simple&'static [Tag]whenever possible, including in Choice trait, and there is a pretty significant performance boost available.I still have to test if there are some side effects what current tests are not showing.
At least current codec implementations just want to know whether tag exists with VARIANTS/EXTENDED_VARIANTS so maybe this can be changed.