Skip to content
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

Skip rebalancing in glue #1094

Merged
merged 1 commit into from
Jan 18, 2025
Merged

Conversation

meooow25
Copy link
Contributor

If two non-empty trees are balanced with respect to each other, removing one element from the larger does not take away that property.

If two non-empty trees are balanced with respect to each other, removing
one element from the larger does not take away that property.
Copy link
Contributor

@treeowl treeowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea how this wasn't caught before, though I doubt it affects performance much. Do the benchmarks show anything?

@meooow25
Copy link
Contributor Author

Yes it's too small a change to make a noticeable difference in our benchmarks.

If I construct a (very artificial) benchmark like

s = Set.fromList [1,2,3]
...
bench "delete123" $ whnf (S.delete 2) s123

the change is ~15.8ns to ~9.7ns.

@treeowl
Copy link
Contributor

treeowl commented Jan 18, 2025

Good catch regardless.

@meooow25 meooow25 merged commit 3641fc4 into haskell:master Jan 18, 2025
13 checks passed
@meooow25 meooow25 deleted the glue-no-rebalance branch January 18, 2025 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants