[GHC] #15620: Speed up Data.Unique

GHC ghc-devs at haskell.org
Sat Sep 8 19:12:17 UTC 2018


#15620: Speed up Data.Unique
-------------------------------------+-------------------------------------
           Reporter:  dfeuer         |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.6.1
          Component:  Core           |           Version:  8.4.3
  Libraries                          |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Runtime
  Unknown/Multiple                   |  performance bug
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 The current `Data.Unique` code seems heavier than necessary:

 1. It uses `Integer` when it can surely get away with less than two words
 on 64-bit systems.

 2. It effectively guarantees that uniques will be consecutive, which isn't
 very useful.

 I don't know how to fix this, but I'm confident there's a better way out
 there.

 One silly idea: use one 100 or so-bit counter per capability. Use the rest
 of the bits to distinguish among the capabilities. To reduce hash
 collisions, make each capability increment its counter by a different
 prime number (or something like that).

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


More information about the ghc-tickets mailing list