Ignore complexity of children in maps/slices/arrays#382
Merged
klauspost merged 1 commit intotinylib:masterfrom Dec 9, 2024
Merged
Ignore complexity of children in maps/slices/arrays#382klauspost merged 1 commit intotinylib:masterfrom
klauspost merged 1 commit intotinylib:masterfrom
Conversation
When considering inlining maps/slices/arrays, apply a fixed cost and ignore the cost of the children. If children are too expensive, they will not be inlined, but it shouldn't affect whether the map itself is inlined. This only really applies when a map or slice type is aliased, otherwise it will not be considered for inlining. Fixes tinylib#381
Member
|
At some point it might be worth checking if the inlining actually does anything for performance at this point. Back when I wrote this code in 2014 the Go compiler had awful inlining heuristics, and couldn't do "mid-stack inlining" at all. That's been fixed for a few years now. |
philhofer
approved these changes
Dec 9, 2024
Collaborator
Author
|
@philhofer To be honest, in my experience the in-liner is still quite bad. And a proper solution has been pushed down the road for years, with PGO promising magic improvements that are only useful in extremely limited scenarios. I would love to be able to inline the Next call manually, so only the Thanks for taking a look. I am pretty sure this will be fine performance-wise - and probably a net zero or minor gain. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When considering inlining maps/slices/arrays, apply a fixed cost and ignore the cost of the children.
If children are too expensive, they will not be inlined, but it shouldn't affect whether the map itself is inlined.
This only really applies when a map or slice type is aliased, otherwise it will not be considered for inlining.
Fixes #381