[GHC] #10400: Run time increases by 40% in fractal plotter core loop

GHC ghc-devs at haskell.org
Sun May 10 21:44:58 UTC 2015


#10400: Run time increases by 40% in fractal plotter core loop
-------------------------------------+-------------------------------------
        Reporter:  saffroy           |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.8.4
      Resolution:                    |                Keywords:
Operating System:  Linux             |            Architecture:  x86_64
 Type of failure:  Runtime           |  (amd64)
  performance bug                    |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by saffroy):

 Replying to [comment:1 nomeata]:
 > Thanks! Looks interesting.

 Thank you for looking!

 Below I am comparing 7.6 (last fast version for my use case) to 7.10 (last
 stable). I have attached various outputs (stats, profiles, cores) for your
 viewing pleasure.

 > Have you compared the RTS stats (pass `+RTS -s` to your binary)?

 Memory usage is considerably smaller with 7.10, though GC times are
 negligible in both cases.

 > Have you compiled your program with profiling enabled, and created a
 profile (`+RTS -p`), and compared that?

 Profiles look the same.

 > Finally, you could compare the produce Core (compile with of `-ddump-
 simpl`) for obvious differences.

 There are differences in the core loop (''iterations''), but I can't
 really tell what changed... Can you please have a look? I have attached
 them.

 > Is there a noticable difference whether you use `take n (repeat ..)` or
 `replicate n ...`? If so, maybe some list fusion is happening or not
 happening. That should be observable in the RTS stats (number of
 allocations), or in the Core.

 So I did this:
 {{{
 --- a/ghc_test.hs
 +++ b/ghc_test.hs
 @@ -16,6 +16,6 @@ inSet !minK !maxK (!x, !y) = k >= minK &
  main = do
      let pointSource = repeat $ ((-0.6518209274278592),
 0.3549264214581329)
          nPoints =  1000 * 1000
 -        points = take nPoints pointSource
 +        points = replicate nPoints $ head pointSource
          selected = filter (inSet 1000 (1000 * 20)) points
      print $ length selected == nPoints
 }}}

 With this change, I see no difference in stats or run time. I do see small
 differences in the core, but for the core loop they seem small.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10400#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list