[commit: ghc] wip/smaller-minJumpTableSize: [Experiment] Try minJumpTableSize = 3 (6bc81c9)

git at git.haskell.org git at git.haskell.org
Tue Sep 19 21:32:45 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/smaller-minJumpTableSize
Link       : http://ghc.haskell.org/trac/ghc/changeset/6bc81c984eb11185d2df8e519f3b8b1410360ae7/ghc

>---------------------------------------------------------------

commit 6bc81c984eb11185d2df8e519f3b8b1410360ae7
Author: Bartosz Nitka <niteria at gmail.com>
Date:   Tue Sep 19 14:31:38 2017 -0700

    [Experiment] Try minJumpTableSize = 3
    
    Summary:
    I want to see gipeda results
    
    Test Plan:
    
    Reviewers:
    
    Subscribers:
    
    Tasks:
    
    Tags:
    
    Blame Revision:


>---------------------------------------------------------------

6bc81c984eb11185d2df8e519f3b8b1410360ae7
 compiler/cmm/CmmSwitch.hs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/compiler/cmm/CmmSwitch.hs b/compiler/cmm/CmmSwitch.hs
index 53d00de..f252caf 100644
--- a/compiler/cmm/CmmSwitch.hs
+++ b/compiler/cmm/CmmSwitch.hs
@@ -66,9 +66,9 @@ maxJumpTableHole = 7
 
 -- | Minimum size of a jump table. If the number is smaller, the switch is
 -- implemented using conditionals.
--- Currently 5, because an if-then-else tree of 4 values is nice and compact.
+-- Currently 3, because that's the heuristic GCC and clang seem to use
 minJumpTableSize :: Int
-minJumpTableSize = 5
+minJumpTableSize = 3
 
 -- | Minimum non-zero offset for a jump table. See Note [Jump Table Offset].
 minJumpTableOffset :: Integer
@@ -302,7 +302,7 @@ splitAtHoles holeSize m = map (\range -> restrictMap range m) nonHoles
 -- (into singleton maps, for now).
 breakTooSmall :: M.Map Integer a -> [M.Map Integer a]
 breakTooSmall m
-  | M.size m > minJumpTableSize = [m]
+  | M.size m >= minJumpTableSize = [m]
   | otherwise                   = [M.singleton k v | (k,v) <- M.toList m]
 
 ---



More information about the ghc-commits mailing list