-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Reduce TypedArena
creations in check_match
.
#71975
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Reduce TypedArena
creations in check_match
.
#71975
Conversation
`check_match` creates a new `TypedArena` for every call to `create_and_enter`. DHAT tells me that each `TypedArena` typically is barely used, with typically a single allocation per arena. This commit moves the `TypedArena` creation outwards a bit, into `check_match`, and then passes it into `create_and_enter`. This reduces the number of arenas created by about 4-5x, for a very small perf win. (Moving the arena creation further outwards is hard because `check_match` is a query.)
@bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit cbc577f with merge a303191d82d1d452f5dfddc9efd98c3341e64b66... |
☀️ Try build successful - checks-actions, checks-azure |
Queued a303191d82d1d452f5dfddc9efd98c3341e64b66 with parent 97f3eee, future comparison URL. |
Why are we even using an arena here? We use cc @varkor do you remember anything here? |
I don't remember why |
It's used a lot in |
It has a single call site.
I tried removing the arena and although I never got it close to compiling (so many lifetime changes needed) I concluded that this was probably the reason. |
The closure isn't necessary.
1a59216
to
d26d187
Compare
@bors r+ |
📌 Commit d26d187 has been approved by |
Rollup of 6 pull requests Successful merges: - rust-lang#71581 (Unify lints handling in rustdoc) - rust-lang#71710 (Test for zero-sized function items not ICEing) - rust-lang#71970 (Improve bitcode generation for Apple platforms) - rust-lang#71975 (Reduce `TypedArena` creations in `check_match`.) - rust-lang#72003 (allow wasm target for rustc-ap-rustc_span) - rust-lang#72017 (Work around ICEs during cross-compilation for target, ast, & attr) Failed merges: r? @ghost
Finished benchmarking try commit a303191d82d1d452f5dfddc9efd98c3341e64b66, comparison URL. |
check_match
creates a newTypedArena
for every call tocreate_and_enter
. DHAT tells me that eachTypedArena
typically isbarely used, with typically a single allocation per arena.
This commit moves the
TypedArena
creation outwards a bit, intocheck_match
, and then passes it intocreate_and_enter
. This reducesthe number of arenas created by about 4-5x, for a very small perf win.
(Moving the arena creation further outwards is hard because
check_match
is a query.)r? @oli-obk