-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce TtParser
#95159
Merged
Merged
Introduce TtParser
#95159
Commits on Mar 18, 2022
-
It currently has no state, just the three methods `parse_tt`, `parse_tt_inner`, and `bb_items_ambiguity_error`. This commit is large but trivial, and mostly consists of changes to the indentation of those methods. Subsequent commits will do more.
Configuration menu - View commit details
-
Copy full SHA for d21b4f3 - Browse repository at this point
Copy the full SHA d21b4f3View commit details -
Rename
bb_items_ambiguity_error
asambiguity_error
.Because it involves `next_items` as well as `bb_items`.
Configuration menu - View commit details
-
Copy full SHA for 354bd10 - Browse repository at this point
Copy the full SHA 354bd10View commit details -
Configuration menu - View commit details
-
Copy full SHA for 39810a8 - Browse repository at this point
Copy the full SHA 39810a8View commit details -
Remove an impossible code path.
Doc comments cannot appear in a matcher.
Configuration menu - View commit details
-
Copy full SHA for 10644e0 - Browse repository at this point
Copy the full SHA 10644e0View commit details
Commits on Mar 20, 2022
-
This type was a small performance win for `html5ever`, which uses a macro with hundreds of very simple rules that don't contain any metavariables. But this type is complicated (extra lifetimes) and perf-neutral for macros that do have metavariables. This commit removes `MatcherPosHandle`, simplifying things a lot. This increases the allocation rate for `html5ever` and similar cases a bit, but makes things easier for follow-up changes that will improve performance more than what we lost here.
Configuration menu - View commit details
-
Copy full SHA for cedb787 - Browse repository at this point
Copy the full SHA cedb787View commit details -
Move items into
TtParser
asVec
s.By putting them in `TtParser`, we can reuse them for every rule in a macro. With that done, they can be `SmallVec` instead of `Vec`, and this is a performance win because these vectors are hot and `SmallVec` operations are a bit slower due to always needing an "inline or heap?" check.
Configuration menu - View commit details
-
Copy full SHA for 754dc8e - Browse repository at this point
Copy the full SHA 754dc8eView commit details
Commits on Mar 22, 2022
-
Eliminate
TokenTreeOrTokenTreeSlice
.As its name suggests, `TokenTreeOrTokenTreeSlice` is either a single `TokenTree` or a slice of them. It has methods `len` and `get_tt` that let it be treated much like an ordinary slice. The reason it isn't an ordinary slice is that for `TokenTree::Delimited` the open and close delimiters are represented implicitly, and when they are needed they are constructed on the fly with `Delimited::{open,close}_tt`, rather than being present in memory. This commit changes `Delimited` so the open and close delimiters are represented explicitly. As a result, `TokenTreeOrTokenTreeSlice` is no longer needed and `MatcherPos` and `MatcherTtFrame` can just use an ordinary slice. `TokenTree::{len,get_tt}` are also removed, because they were only needed to support `TokenTreeOrTokenTreeSlice`. The change makes the code shorter and a little bit faster on benchmarks that use macro expansion heavily, partly because `MatcherPos` is a lot smaller (less data to `memcpy`) and partly because ordinary slice operations are faster than `TokenTreeOrTokenTreeSlice::{len,get_tt}`.
Configuration menu - View commit details
-
Copy full SHA for 31df680 - Browse repository at this point
Copy the full SHA 31df680View commit details
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.