Skip to content

Excessive and insufficient inlining #31

Open
@sgraf812

Description

@sgraf812

While going through https://gitlab.haskell.org/ghc/ghc/-/issues/19283, @bgamari noticed that many call sites in statistics fail to inline vector-algorithm functions, probably because some of them are recursive or just too huge to inline.

I haven't looked at the Core, but the use of Comparison and delegation of sort to sortBy suggests that the comparator won't properly specialise in some cases, namely when the function binding the Comparison isn't inlined.

I think it might be better to mark them INLINABLE and have clients SPECIALISE if needed. Although the Comparison matter might need special handling, by re-introducing it as a type class. This way, call sites pay for specialisation if they want.

That might also substantitally speed up compilation of tests/properties/Tests.hs, which took 20s on my machine, about as long as it took to compile the whole package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions