[GHC] #10652: Better cache performance in Array#

GHC ghc-devs at haskell.org
Sat Jul 18 04:27:59 UTC 2015


#10652: Better cache performance in Array#
-------------------------------------+-------------------------------------
        Reporter:  MikeIzbicki       |                   Owner:
            Type:  feature request   |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.10.1
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by MikeIzbicki):

 Replying to [comment:3 carter]:
 > Mike: have you looked at how the gc arranges values only reachable via a
 boxed array?

 I wouldn't even know where to look for this.  My only evidence that things
 aren't aligned is the huge number of cache misses I'm getting.  But I
 suppose these cache misses could be caused by something else.

 > I guess one problem I can think of off hand is that your primops get
 tricky when a value is shared across Multiple boxed arrays!

 My proposal doesn't run into this problem.  I'm specifically not proposing
 that GHC try to find a "globally optimal" memory allocation scheme.
 Instead, all I want is that immediately after these operations are called
 memory is aligned.  A subsequent call to these primops on another array
 with the same elements in a different order would destroy that alignment.

 > A valid and interesting idea would be to just make sure that the gc
 places unshared values reachable only via a boxed array continuously when
 doing a copying gc.  I should try to look into this myself.

 I think this would work for me, and probably be better in general
 performance-wise.  I was just (maybe naively) imagining this would be
 harder to implement.

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


More information about the ghc-tickets mailing list