Sometimes functions are not inlined #22

Shimuuar opened this Issue Dec 19, 2011 · 1 comment


None yet
1 participant

Shimuuar commented Dec 19, 2011

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 added a commit that referenced this issue Aug 31, 2012

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

This comment has been minimized.

Show comment Hide comment

Shimuuar Jul 27, 2014


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


Shimuuar commented Jul 27, 2014

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

@Shimuuar Shimuuar closed this Jul 27, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment