Skip to content

Better unordered folds? #112

@treeowl

Description

@treeowl

I'm not a huge fan of the way we implement unordered folds. The compiler has no clue what they're up to, so optimization is garbage. I experimented with using an operation

viewU :: BinomHeap a -> Maybe (a, BinomHeap a)

which extracts the root of the first binomial tree, to implement foldlU'.

Unfortunately, the performance was worse than what we do now. But I wonder if things might change if we work in bigger chunks. For starters, something like

viewU2 :: BinomForest (Succ Zero) a -> Maybe (a, a, BinomForest (Succ Zero) a)

Working with two elements at once should reduce the churn in the low bits, and might give this technique some hope.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions