
#14980: Runtime performance regression with binary operations on vectors -------------------------------------+------------------------------------- Reporter: ttylec | Owner: bgamari Type: bug | Status: new Priority: high | Milestone: 8.8.1 Component: Compiler | Version: 8.2.2 Resolution: | Keywords: vector | bitwise operations 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: | -------------------------------------+------------------------------------- Comment (by ttylec): Sorry for long inactivity. I had some time to do more tests recently, based on your suggestions. To focus attention, I tried to investigate difference between: - `performance-bug-pair-1`: 256 columns - `performance-bug-pair-2`: 64 and 256, the same code as in `performance- bug-pair-1` but with 64 column check uncommented On ghc-8.2.2 and ghc-8.0.2. - on ghc-8.2.2, `performance-bug-pair-2` behaves as expected -- we have speedup for both 64 and 256 columns, `performance-bug-pair-1` does not have speed-up. - on ghc-8.0.2, I see speedup in both cases. Based on @tdammers example, I tried to print fired rules difference between both `performance-bug-pair-1` and `performance-bug-pair-2`, using analogous diff expression: {{{ ➜ ghc-bug diff <(grep '^Rule' rules-firing1-1 | sort -u) <(grep '^Rule' rules-firing-2 | sort -u) -u | grep '^[+-]' --- /proc/self/fd/13 2018-10-23 15:49:27.063541325 +0200 +++ /proc/self/fd/14 2018-10-23 15:49:27.067541342 +0200 -Rule fired: eftIntList (GHC.Enum) -Rule fired: stream/unstream [Vector] (Data.Vector.Generic) +Rule fired: SPEC matchPacked @ BPack4 (Main) +Rule fired: SPEC matchPacked @ BPack (Main) }}} `-` are rules that fired for `performance-bug-pair-1` (the bad) and `+` are rules that fired for `performance-bug-pair-2`. It's not about specialization, because I even tried to compile with `performance-bug-pair-1` with explicit monomorphic type. The only common rule on both rules, that fired in bad case and did not fire in good is `Rule fired: stream/unstream [Vector] (Data.Vector.Generic)`. Not that I understand it... but it seems that firing that rule interferes with some GHC optimizations? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14980#comment:28 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler