Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Sometimes functions are not inlined #22

Closed
Shimuuar opened this Issue · 1 comment

1 participant

@Shimuuar
Collaborator

Sometimes functions in the Statistics.Sample are not inlined and GHC just uses generic version which leads to considerable slowdown. AFAIK function gets inlined only if fully saturated as declared.

variance xs = ...

some_function variance -- Variance won't be inlined there

There are two possible ways to deal with it. First is to declare functions with zero arguments using pointfree style or with lambdas variance = \x → .... Another is to add SPECIALIZE pragmas to get efficient versions for different types of vectors.

I'm not sure how does it affect real world code but benchmark suite is affected badly.

@Shimuuar Shimuuar referenced this issue from a commit
@Shimuuar Shimuuar Group benchmarks and saturate function application as stopgap measure.
Otherwise functions won't get inlined and specialized with corresponding
performance loss.

As long as issue #22 is unfixed one have to saturate function application
in benchmark in order to measure performance of optimized functions
5d39317
@Shimuuar Shimuuar referenced this issue from a commit
@Shimuuar Shimuuar Group benchmarks and saturate function application as stopgap measure.
Otherwise functions won't get inlined and specialized with corresponding
performance loss.

As long as issue #22 is unfixed one have to saturate function application
in benchmark in order to measure performance of optimized functions
7d1ebdf
@Shimuuar
Collaborator

It's relatively well known feature of GHC inliner so I'm closing issue

@Shimuuar Shimuuar closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.