[Git][ghc/ghc][wip/T24245] 5 commits: Improve performance of Data.List.sort(By)

Oleg Grenrus (@phadej) gitlab at gitlab.haskell.org
Mon May 13 17:48:20 UTC 2024



Oleg Grenrus pushed to branch wip/T24245 at Glasgow Haskell Compiler / GHC


Commits:
fc2d6de1 by Jade at 2024-05-10T21:07:16-04:00
Improve performance of Data.List.sort(By)

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
-------------------------

- - - - -
1012e8aa by Matthew Pickering at 2024-05-10T21:07:52-04:00
Revert "ghcup-metadata: Drop output_name field"

This reverts commit ecbf22a6ac397a791204590f94c0afa82e29e79f.

This breaks the ghcup metadata generation on the nightly jobs.

- - - - -
daff1e30 by Jannis at 2024-05-12T13:38:35-04:00
Division by constants optimization

- - - - -
413217ba by Andreas Klebinger at 2024-05-12T13:39:11-04:00
Tidy: Add flag to expose unfoldings if they take dictionary arguments.

Add the flag `-fexpose-overloaded-unfoldings` to be able to control this
behaviour.

For ghc's boot libraries file size grew by less than 1% when it was
enabled. However I refrained from enabling it by default for now.

I've also added a section on specialization more broadly to the users
guide.

-------------------------
Metric Decrease:
    MultiLayerModulesTH_OneShot
Metric Increase:
    T12425
    T13386
    hard_hole_fits
-------------------------

- - - - -
3088ae77 by Oleg Grenrus at 2024-05-13T20:48:13+03:00
Add reflections of GHC.TypeLits/Nats type families

- - - - -


27 changed files:

- .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
- compiler/GHC/Cmm/Config.hs
- compiler/GHC/Cmm/MachOp.hs
- compiler/GHC/Cmm/Opt.hs
- compiler/GHC/Cmm/Pipeline.hs
- compiler/GHC/Cmm/Sink.hs
- compiler/GHC/Driver/Config/Cmm.hs
- compiler/GHC/Driver/Config/Tidy.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Iface/Tidy.hs
- compiler/GHC/StgToCmm/Prim.hs
- docs/users_guide/9.12.1-notes.rst
- docs/users_guide/hints.rst
- docs/users_guide/using-optimisation.rst
- libraries/base/changelog.md
- libraries/ghc-experimental/ghc-experimental.cabal
- + libraries/ghc-experimental/src/GHC/TypeLits/Experimental.hs
- + libraries/ghc-experimental/src/GHC/TypeNats/Experimental.hs
- libraries/ghc-internal/src/GHC/Internal/Data/OldList.hs
- + testsuite/tests/lib/base/Sort.hs
- + testsuite/tests/lib/base/Sort.stdout
- testsuite/tests/lib/base/all.T
- + testsuite/tests/numeric/should_run/T24245.hs
- + testsuite/tests/numeric/should_run/T24245.stdout
- testsuite/tests/numeric/should_run/all.T
- + testsuite/tests/numeric/should_run/div01.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8bf6a34eec24a7fb65137910f985580b076f5a86...3088ae77ca9a2c3800f85683cf20bf36fdaff005

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8bf6a34eec24a7fb65137910f985580b076f5a86...3088ae77ca9a2c3800f85683cf20bf36fdaff005
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240513/a29325b1/attachment-0001.html>


More information about the ghc-commits mailing list