[GHC] #6166: Performance regression in mwc-random since 7.0.x
GHC
ghc-devs at haskell.org
Wed Oct 14 12:50:51 UTC 2015
#6166: Performance regression in mwc-random since 7.0.x
-------------------------------------+-------------------------------------
Reporter: bos | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 8.0.1
Component: Compiler | Version: 7.4.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: x86_64
Type of failure: Runtime | (amd64)
performance bug | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Description changed by bgamari:
Old description:
> I've had a report that the performance of the mwc-random package has
> regressed seriously after upgrading from GHC 7.0 to 7.4. It turns out
> that 7.2 also has the regression.
>
> Here's a sample program.
>
> {{{
> import qualified Data.Vector.Unboxed as U
>
> import qualified System.Random.MWC as R
> import System.Random.MWC.Distributions (standard)
>
> count = 1000 * 1000
>
> fast gen = standard gen
>
> slow gen = standard gen >>= return
>
> -- Edit this to choose fast or slow.
> which gen = slow gen
>
> main = do
> gen <- R.create
> v <- U.replicateM count (which gen)
> print (U.last v)
> }}}
>
> With GHC 7.0.3 -O2, this runs in 0.294 sec, regardless of whether `fast`
> or `slow` is used.
>
> Under 7.4, `fast` runs in 0.062 sec (a nice speedup!), but `slow` now
> takes 9.2 sec (yikes!).
>
> Roman suggested compiling the `slow` version with `-fno-state-hack`,
> which brings performance back up to 0.062 sec.
New description:
I've had a report that the performance of the mwc-random package has
regressed seriously after upgrading from GHC 7.0 to 7.4. It turns out that
7.2 also has the regression.
Here's a sample program.
{{{#!hs
import qualified Data.Vector.Unboxed as U
import qualified System.Random.MWC as R
import System.Random.MWC.Distributions (standard)
count = 1000 * 1000
fast gen = standard gen
slow gen = standard gen >>= return
-- Edit this to choose fast or slow.
which gen = slow gen
main = do
gen <- R.create
v <- U.replicateM count (which gen)
print (U.last v)
}}}
With GHC 7.0.3 -O2, this runs in 0.294 sec, regardless of whether `fast`
or `slow` is used.
Under 7.4, `fast` runs in 0.062 sec (a nice speedup!), but `slow` now
takes 9.2 sec (yikes!).
Roman suggested compiling the `slow` version with `-fno-state-hack`, which
brings performance back up to 0.062 sec.
--
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/6166#comment:16>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list