[GHC] #14980: Runtime performance regression with binary operations on vectors

GHC ghc-devs at haskell.org
Tue Jun 26 14:20:10 UTC 2018


#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 tdammers):

 Profiled builds don't seem to reveal much, because as soon as I enable
 profiling, the performance difference between LTS 9 / GHC 8.0.2 and LTS 11
 / GHC 8.2.2 disappears almost entirely - in fact, a profiling build from
 LTS 9 is *slower* than one from LTS 11.

 Profile output from LTS 9:
 {{{
         Tue Jun 26 16:12 2018 Time and Allocation Profiling Report
 (Final)

            performance-bug-2 +RTS -p -RTS

         total time  =       28.28 secs   (28277 ticks @ 1000 us, 1
 processor)
         total alloc = 24,003,734,896 bytes  (excludes profiling overheads)

 COST CENTRE       MODULE                            SRC
 %time %alloc

 >>=               Data.Vector.Fusion.Util
 Data/Vector/Fusion/Util.hs:36:3-18                      12.4   19.9
 compile'.\        Main                              performance-
 bug-2.hs:40:22-33                           11.4    4.3
 basicUnsafeIndexM Data.Vector.Primitive
 Data/Vector/Primitive.hs:222:3-75                       10.9   16.1
 matchPacked       Main                              performance-
 bug-2.hs:(108,1)-(111,27)                    8.8   11.0
 uniform           System.Random.MWC
 System/Random/MWC.hs:217:5-33                            8.7   15.0
 basicUnsafeIndexM Data.Vector.Unboxed.Base
 Data/Vector/Unboxed/Base.hs:266:841-899                  6.6    0.0
 matchPacked.go    Main                              performance-
 bug-2.hs:(110,5)-(111,27)                    3.7    0.4
 >>=               Data.Vector.Fusion.Util
 Data/Vector/Fusion/Util.hs:50:3-19                       3.3    2.6
 getOverhead       Criterion.Monad
 Criterion/Monad.hs:(47,1)-(56,12)                        3.3    0.0
 basicUnsafeWrite  Data.Vector.Primitive.Mutable
 Data/Vector/Primitive/Mutable.hs:115:3-69                2.7    2.3
 basicUnsafeIndexM Data.Vector.Unboxed.Base
 Data/Vector/Unboxed/Base.hs:345:3-73                     2.6   11.2
 matched.matches   Main                              performance-
 bug-2.hs:28:5-27                             2.4    0.0
 basicUnsafeIndexM Data.Vector.Unboxed.Base          internal/unbox-tuple-
 instances:(452,3)-(458,29)          2.2    0.0
 compile'          Main                              performance-
 bug-2.hs:40:1-33                             1.7    0.0
 compile.cc        Main                              performance-
 bug-2.hs:37:5-28                             1.6    0.0
 getGCStats        Criterion.Measurement
 Criterion/Measurement.hs:(46,1)-(48,16)                  1.5    0.0
 matched           Main                              performance-
 bug-2.hs:(23,1)-(29,23)                      1.5    2.4
 basicLength       Data.Vector.Unboxed.Base
 Data/Vector/Unboxed/Base.hs:343:3-42                     1.1    0.0
 fmap              Data.Vector.Fusion.Stream.Monadic
 Data/Vector/Fusion/Stream/Monadic.hs:(133,3)-(135,20)    0.7    1.0
 toPacked4.inst    Main                              performance-
 bug-2.hs:88:5-26                             0.6    1.1
 pack64bit         Main                              performance-
 bug-2.hs:(59,1)-(62,23)                      0.6    1.8
 }}}

 And LTS 11:
 {{{
         Tue Jun 26 14:26 2018 Time and Allocation Profiling Report
 (Final)

            performance-bug-2 +RTS -p -RTS

         total time  =       23.79 secs   (23791 ticks @ 1000 us, 1
 processor)
         total alloc = 17,329,594,624 bytes  (excludes profiling overheads)

 COST CENTRE       MODULE                            SRC
 %time %alloc

 >>=               Data.Vector.Fusion.Util
 Data/Vector/Fusion/Util.hs:36:3-18                      19.4   26.9
 basicUnsafeIndexM Data.Vector.Primitive
 Data/Vector/Primitive.hs:222:3-75                       14.8   18.3
 compile'.\        Main                              performance-
 bug-2.hs:40:22-33                           13.0    5.0
 matchPacked       Main                              performance-
 bug-2.hs:(108,1)-(111,27)                    7.2    8.6
 >>=               Data.Vector.Fusion.Util
 Data/Vector/Fusion/Util.hs:50:3-19                       4.2    3.0
 basicUnsafeIndexM Data.Vector.Unboxed.Base
 Data/Vector/Unboxed/Base.hs:266:841-899                  3.9    0.0
 matchPacked.go    Main                              performance-
 bug-2.hs:(110,5)-(111,27)                    3.4    0.4
 primitive         Control.Monad.Primitive
 Control/Monad/Primitive.hs:178:3-16                      3.2    0.2
 basicUnsafeIndexM Data.Vector.Unboxed.Base
 Data/Vector/Unboxed/Base.hs:345:3-73                     2.9   13.2
 matched.matches   Main                              performance-
 bug-2.hs:28:5-27                             2.7    0.0
 uniform           System.Random.MWC
 System/Random/MWC.hs:217:5-33                            2.0    0.9
 matched           Main                              performance-
 bug-2.hs:(23,1)-(29,23)                      2.0    2.8
 basicUnsafeIndexM Data.Vector.Unboxed.Base          internal/unbox-tuple-
 instances:(452,3)-(458,29)          1.8    0.0
 compile'          Main                              performance-
 bug-2.hs:40:1-33                             1.7    0.0
 basicUnsafeWrite  Data.Vector.Primitive.Mutable
 Data/Vector/Primitive/Mutable.hs:115:3-69                1.5    4.2
 compile.cc        Main                              performance-
 bug-2.hs:37:5-28                             1.5    0.0
 basicLength       Data.Vector.Unboxed.Base
 Data/Vector/Unboxed/Base.hs:343:3-42                     1.2    0.0
 toPacked4.inst    Main                              performance-
 bug-2.hs:88:5-26                             0.9    1.5
 basicUnsafeRead   Data.Vector.Primitive.Mutable
 Data/Vector/Primitive/Mutable.hs:112:3-63                0.7    1.7
 fmap              Data.Vector.Fusion.Stream.Monadic
 Data/Vector/Fusion/Stream/Monadic.hs:(133,3)-(135,20)    0.7    1.1
 take64.(...)      Main                              performance-
 bug-2.hs:66:17-38                            0.6    2.3
 }}}

 And the main culprits are roughly the same, give or take ordering.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14980#comment:14>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list