
#9646: Simplifer non-determinism leading to 8 fold difference in run time performance -------------------------------------+------------------------------------- Reporter: erikd | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: Runtime | Difficulty: Unknown performance bug | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Description changed by erikd: Old description:
I've been chasing a weird performance bug for about a week now. I've reduced the testcase to the following git repo:
https://github.com/erikd/ghc-perfbug-test
The Readme.md file in that repo contains an explanation of how to reproduce the issue.
The benchmark program in the repo uses Criterion to test the performance of one particular function. Running the program in a particular way results into two significanlty different results.
The commands are:
{{{ make clean bench-integer.html cp -f bench-integer.html bench-integer-slow.html touch New3/GHC/Integer/Natural.hs && make bench-integer.html }}}
The results for one function in the file `New3/GHC/Integer/Natural.hs` is 8 times slower in the first test that the second while the other test function always executes at about the speed.
I haven't been able to test this with ghc-7.6.3 because the code uses `isTrue#` which isn't available in 7.6.3.
New description: I've been chasing a weird performance bug for about a week now. I've reduced the testcase to the following git repo: https://github.com/erikd/ghc-perfbug-test The Readme.md file in that repo contains an explanation of how to reproduce the issue. The benchmark program in the repo uses Criterion to test the performance of one particular function. Running the program in a particular way results into two significanlty different results. The commands are: {{{ make clean bench-integer.html cp -f bench-integer.html bench-integer-slow.html touch New3/GHC/Integer/Natural.hs && make bench-integer.html }}} The results for one function in the file `New3/GHC/Integer/Natural.hs` is 8 times slower in the first test that the second while the other test function always executes at about the speed. I haven't been able to test this with ghc-7.6.3 because the code uses `isTrue#` which isn't available in 7.6.3. Updated explanation: Compiling the whole project results in the function under test running 4 times slower than the comparison. Touching the file containing the function under test and rebuilding the benchmark program results in the function under test runing 2 times faster than the comparison function. Dumping intermediate files showed that the output of the simplifier was different enough to create this 8 fold difference in performance. The simplifier should be deterministic. Same input file should result in the same simplifier output, preferably the output that results in 8 fold better performance. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9646#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler