Skip to content
  • Jade's avatar
    Improve performance of Data.List.sort(By) · fc2d6de1
    Jade authored and Marge Bot's avatar Marge Bot committed
    This patch improves the algorithm to sort lists in base.
    It does so using two strategies:
    
    1) Use a four-way-merge instead of the 'default' two-way-merge.
    This is able to save comparisons and allocations.
    
    2) Use `(>) a b` over `compare a b == GT` and allow inlining and specialization.
    This mainly benefits types with a fast (>).
    
    Note that this *may* break instances with a *malformed* Ord instance
    where `a > b` is *not* equal to `compare a b == GT`.
    
    CLC proposal: https://github.com/haskell/core-libraries-committee/issues/236
    
    Fixes #24280
    
    -------------------------
    Metric Decrease:
        MultiLayerModulesTH_Make
        T10421
        T13719
        T15164
        T18698a
        T18698b
        T1969
        T9872a
        T9961
        T18730
        WWRec
        T12425
        T15703
    -------------------------
    fc2d6de1
To find the state of this project's repository at the time of any of these versions, check out the tags.