Extend performance group with container-construction hints#1694
Open
mgajda wants to merge 1 commit intondmitchell:masterfrom
Open
Extend performance group with container-construction hints#1694mgajda wants to merge 1 commit intondmitchell:masterfrom
mgajda wants to merge 1 commit intondmitchell:masterfrom
Conversation
Adds fully-qualified rewrites for no-op container operations that are
semantically identical to their shorter form but cost an O(n) pass.
Every match uses fully-qualified module names so it only fires on the
specific API the user imported.
- Data.{Map,IntMap,HashMap}.{Strict,Lazy}.union with empty -> the map
- Data.{Set,HashSet}.union with empty -> the set
- Data.{Map,IntMap,HashMap}.Lazy.map id -> the map
- Data.{Set,HashSet}.map id -> the set
The Strict map-id rewrites are deliberately NOT added: removing the
call would change evaluation semantics for containers holding bottoms.
All rules live in the opt-in `performance` group (enabled: false).
Part of a set of independent PRs adding rule families to that group;
each PR creates its own `performance` group block which merges cleanly
with the others on the maintainer's end.
6b84ea7 to
438494d
Compare
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.
Part of a set of independent PRs adding rules to the opt-in
performancegroup (disabled by default; enabled via--with-group=performanceor per-project config). Each PR in the setcreates its own
performancegroup block; the blocks merge cleanly.This one covers redundant container construction (identity rewrites).
Rules added
All fully-qualified so they fire only on the exact API users imported.
Data.{Map,IntMap,HashMap}.{Strict,Lazy}.union m empty(both orders) →mData.{Set,HashSet}.union s empty(both orders) →sData.{Map,IntMap,HashMap}.Lazy.map id m→mData.{Set,HashSet}.map id s→s