[GHC] #9159: cmm case, binary search instead of jump table
GHC
ghc-devs at haskell.org
Mon Jun 2 20:33:17 UTC 2014
#9159: cmm case, binary search instead of jump table
--------------------------------------------+------------------------------
Reporter: wojteknar | Owner:
Type: feature request | Status: new
Priority: low | Milestone:
Component: Compiler | Version: 7.8.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Runtime performance bug | Unknown/Multiple
Test Case: | Difficulty: Unknown
Blocking: | Blocked By:
| Related Tickets:
--------------------------------------------+------------------------------
Changes (by rwbarton):
* type: bug => feature request
Comment:
Presumably the case on an `Int#` uses a binary search because there's no
reason the cases need to be consecutive integers: imagine you change the
last case to `1000000# -> Chunk08 w#`. Now a jump table is not a good
idea. The case on a `Nat` knows that the tag integer identifying the
constructor will be in the range from 0 to 8.
We would need some heuristic for when to use binary search vs. a jump
table (or perhaps both, if the cases to be matched consist of multiple
ranges of consecutive integers). Maybe worth looking into what C compilers
do.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9159#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list