Skip to content
Snippets Groups Projects
H

haskeline

Project ID: 665
Forked from Glasgow Haskell Compiler / Packages / haskeline
Source project has a limited visibility.
Soumik Sarkar's avatar
meooow authored
linkL restores balance when the left tree is too heavy for the right
tree, but unlike link it skips checking the other way around. linkR
handles the opposite. linkL and linkR are used where we know the
direction in which we need to rebalance.

linkL and linkR delegate to linkL_ and linkR_, which do the actual work.
link also delegates to linkL_ and linkR_, since the direction does not
change when linking two trees. This single-direction linking algorithm
can be seen in Figure 4 of "Parallel Ordered Sets Using Join". Similarly,
link2/merge delegates to link2L_,link2_R/mergeL_,mergeR_.

Benchmarks show a decrease in time and allocations, especially in set-set
operations like union. Inspection of the Core of the previous link
implementation revealed that it reboxes trees in some cases, which
explains the decrease in allocations.
9498edfd
History
Name Last commit Last update