
#8763: forM_ [1..N] does not get fused (10 times slower than go function) -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: #7206 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by George): Attached file fuse.hs , similar to the first file but with nested forM_, both versions run in the same time but the forM_ version allocates about 50% more {{{ ghc -O2 fuse.hs +RTS [1 of 1] Compiling Main ( fuse.hs, fuse.o ) Linking fuse ... bash-3.2$ ./fuse 1 +RTS -s 486341683267690 320,057,352 bytes allocated in the heap 8,232 bytes copied during GC 44,576 bytes maximum residency (1 sample(s)) 29,152 bytes maximum slop 308 MB total memory in use (0 MB lost due to fragmentation) Tot time (elapsed) Avg pause Max pause Gen 0 1 colls, 0 par 0.000s 0.000s 0.0000s 0.0000s Gen 1 1 colls, 0 par 0.000s 0.025s 0.0254s 0.0254s INIT time 0.000s ( 0.003s elapsed) MUT time 5.432s ( 5.634s elapsed) GC time 0.000s ( 0.025s elapsed) EXIT time 0.000s ( 0.005s elapsed) Total time 5.433s ( 5.667s elapsed) %GC time 0.0% (0.4% elapsed) Alloc rate 58,918,474 bytes per MUT second Productivity 100.0% of total user, 99.5% of total elapsed bash-3.2$ ./fuse 2 +RTS -s 486341683267690 560,057,328 bytes allocated in the heap 15,992 bytes copied during GC 320,028,576 bytes maximum residency (2 sample(s)) 868,448 bytes maximum slop 308 MB total memory in use (0 MB lost due to fragmentation) Tot time (elapsed) Avg pause Max pause Gen 0 228 colls, 0 par 0.001s 0.002s 0.0000s 0.0001s Gen 1 2 colls, 0 par 0.000s 0.026s 0.0128s 0.0254s INIT time 0.000s ( 0.003s elapsed) MUT time 5.453s ( 5.630s elapsed) GC time 0.002s ( 0.027s elapsed) EXIT time 0.000s ( 0.008s elapsed) Total time 5.455s ( 5.667s elapsed) %GC time 0.0% (0.5% elapsed) Alloc rate 102,698,216 bytes per MUT second Productivity 100.0% of total user, 99.5% of total elapsed }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8763#comment:42 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler