[GHC] #9599: app runs 10 times faster when compiled with profilling information than without it

#9599: app runs 10 times faster when compiled with profilling information than without it -------------------------------------+------------------------------------- Reporter: kgardas | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Keywords: | Operating System: Solaris Architecture: x86 | Type of failure: Runtime Difficulty: Unknown | performance bug Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Hello, I've found interesting application code which when compiled with {{{ -O2 -threaded --make }}} runs 10 times slower than the same code compiled with {{{ -O2 -threaded --make -prof -auto-all -caf-all -fforce-recomp }}} the application is compiled by GHC 7.8.2 on i386-solaris2 platform. The profiling application is then run as normal application, i.e. without +RTS -p. The application itself is my crude beginner Haskell code which takes Wikipedia dump (XML file) and tries wiki pages from there import into XWiki using REST API. It uses Data.Text package for lazy load of Wikipedia data, whole logic of selection of page/title/content is done on Data.Text and later saved into XPage which is using ByteString. The application also uses Simon Marlow's Async/async/wait code which is copied from Simon Marlow's Parallel and Concurrent Programming in Haskell http://chimera.labs.oreilly.com/books/1230000000929 App attached. My question is, what to do with it to help finding the issue? E.g. I assume it's issue when profiling app is that much faster than common optimized app. For your information, optimized app takes 9m50s to upload 1000 pages while profiled optimized app takes only 50s to upload the same amount of pages on my equipped with E5-2620 (2 GHz 6 core/12 threads xeon) Also the difference in time is that big that it's not caused by a noise in import of pages on XWiki side. I've tested several times of course. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9599 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9599: app runs 10 times faster when compiled with profilling information than without it -------------------------------------+------------------------------------- Reporter: kgardas | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Runtime | Difficulty: Unknown performance bug | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by rwbarton): The presence of SCC annotations can inhibit certain optimizations; perhaps one of those optimizations is in fact making your non-profiled program much slower. I'd try building it with `-fno-full-laziness` and/or `-fno- state-hack`. For that matter, what is the performance like of the two versions with optimizations turned off completely? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9599#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9599: app runs 10 times faster when compiled with profilling information than without it -------------------------------------+------------------------------------- Reporter: kgardas | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Runtime | Difficulty: Unknown performance bug | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by simonpj): Another way to get some insight into what is going on is to use `-ticky`. See [wiki:Debugging/TickyTicky]. Reid's instincts about what to try are spot on: try those things too. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9599#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9599: app runs 10 times faster when compiled with profilling information than without it -------------------------------------+------------------------------------- Reporter: kgardas | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Runtime | Difficulty: Unknown performance bug | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by kgardas): Based on the feedback I'm adding time testing with several combinations of GHC options. I'm benchmarking here 1000 pages import like in the original report. Time around 40s is computerd as average from several runs. Time in minutes is from one run. ||time||options|| ||40s||--make|| ||40s||--make -prof -auto-all -caf-all -fforce-recomp|| ||39s||-threaded --make|| ||40s||-threaded --make -prof -auto-all -caf-all -fforce-recomp|| ||9m12s||-O -threaded --make|| ||9m40s||-O -threaded --make -fno-full-laziness|| ||15m3s||-O -threaded --make -fno-state-hack|| ||40s||-O -threaded --make -prof -auto-all -caf-all -fforce-recomp|| I'll see yet what I can do with -ticky suggestion here. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9599#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9599: app runs 10 times faster when compiled with profilling information than without it -------------------------------------+------------------------------------- Reporter: kgardas | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Runtime | Test Case: performance bug | Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by George): * status: new => infoneeded Comment: Any updates? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9599#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC