This repository has been archived by the owner on Sep 14, 2023. It is now read-only.
Remove seemingly unnecessary Repeat patterns #201
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.
This should make the tests in PR #185 much faster.
This was the pattern before my change:
The
Repeat(Optional([Repeat(...
causes an explosion in the functionstates
.states
was being called 1,421,237 times, and producing a vector of 236,975 elements.This is the pattern after:
states
is being called 7,843 times, and producing a vector of 2,296 elements.I'm not sure why the removed code was ever written. The concept of "has_repeat" means that the short can possibly repeat under some context somewhere, which seems to have a completely separate meaning from the Repeat(...) pattern. Furthermore, this extra Repeat(...) pattern only affects the second sequence and not the first. That's because after the first sequence is processed, Short('p') is flagged as something that repeats, which affects only the second sequence.