cross module optimization issues
simonpj at microsoft.com
Fri Nov 21 05:33:41 EST 2008
| This project is based on Oleg's Iteratee code; I started using his
| IterateeM.hs and Enumerator.hs files and added my own stuff to
| Enumerator.hs (thanks Oleg, great work as always). When I started
| cleaning up by moving my functions from Enumerator.hs to MyEnum.hs, my
| minimal test case increased from 19s to 43s.
| I've found two factors that contributed. When I was cleaning up, I
| also removed a bunch of unused functions from IterateeM.hs (some of
| the test functions and functions specific to his running example of
| HTTP encoding). When I added those functions back in, and added
| INLINE pragmas to the exported functions in MyEnum.hs, I got the
| performance back.
| In general I hadn't added export lists to the modules yet, so all
| functions should have been exported.
I'm totally snowed under with backlog from my recent absence, so I can't look at this myself, but if anyone else wants to I'd be happy to support with advice and suggestions.
In general, having an explicit export list is good for performance. I typed an extra section in the GHC performance resource http://haskell.org/haskellwiki/Performance/GHC to explain why. In general that page is where we should document user advice for performance in GHC.
I can't explain why *adding* unused functions would change performance though!
More information about the Glasgow-haskell-users