cmm case, binary search instead of jump table
|Reported by:||wojteknar||Owned by:|
|Type of failure:||Runtime performance bug||Test Case:|
|Related Tickets:||#10137||Differential Rev(s):|
I'm not sure if this is qualifies as a bug or feature request.
For case expressions where the scrutinee is Int#,or Int, or probably anything else numerical, GHC generates binary search, where a jump table could easily be used instead. The functions toChunk1# and toChunk2# yield suboptimal code. I found a satisfactory workaround, toChunk3# uses Enum and it is fine.
For the attached code it probably does not matter much, but I have 65 cases in my real code, trying to implement a variant of ByteString, which will have the lowest possible storage overhead (just the info table pointer == one word) for lengths up to 64 bytes.