
#14971: Use appropriatly sized comparison instruction for small values. -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: task | Status: new Priority: normal | Milestone: Component: Compiler | Version: (CodeGen) | Resolution: | Keywords: CodeGen Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by AndreasK): Replying to [comment:1 simonpj]:
Sounds good! 1.5% is a lot. How did you get that figure?
Indeed it's more than I would have expected. But these are micro benchmarks so it's hard to predict how much of that will remain when running regular programs. Given that cache behaviour and cpu bottlecks would be different there. I've compiled two criterion benchmarks and changed the assembly by Hand. One example was: {{{ module Main (main) where import Criterion.Main mapInt :: Int -> Int mapInt 1 = 111 mapInt 2 = 211 mapInt 3 = 311 {-# NOINLINE sumAndLookup #-} sumAndLookup :: [Int] -> Int sumAndLookup = sum . map mapInt main = do let value = map (\x -> 1 + x `mod` 3) [1..30] print (sumAndLookup value) defaultMain [ bgroup "opSize" [ bench "caseOfThree" $ whnf sumAndLookup value] ] }}}
Do you have a patch :-)?
Not yet. I submitted a project proposal for Summer of Code which includes writing a patch for this. But if that should not work out I still expect to get around to it eventually. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14971#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler