Split function for anti-diff finger tree that is based on heuristics #4269
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.
Description
Closes #4268.
We add a
splitSized
function that computes a split and the corresponding split root measures using a heuristic, which theSized
class provides. One example of a sensibleSized
instance would be one that computes the length of a finger tree. We can view thesplitSized
function as an equivalent function that delegates tosplitl
andsplitr
based on the heuristic.We also perform comparative benchmarks, where we compare the performance of
splitl
,splitr
andsplitSized
for three scenarios:splitl
's worst-case running time: a split at the end of the finger tree.splitr
's worst-case running time: a split at the start of the finger tree.In scenario 1,
splitl
performs much better thansplitr
, which is expected, andsplitc
performs only slightly worse thansplitl
. In scenario 2,splitl
performs much worse thansplitr
, which is expected, andsplitSized
performs only slightly worse thansplitr
. In Scenario 3, we see nearly identical performance for all three split functions.Checklist
interface-CHANGELOG.md
interface-CHANGELOG.md