Optimise writing out the .s file
authorSimon Marlow <marlowsd@gmail.com>
Mon, 2 Feb 2009 14:50:13 +0000 (14:50 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Mon, 2 Feb 2009 14:50:13 +0000 (14:50 +0000)
commit6ba3d614390f83c32e97593c4ae03a6b0355f474
tree70a35bfd7bda5d8b8fd822ed1ee4631bd323322c
parent87a00632efef6891ea67e095fd6d3490a274d83c
Optimise writing out the .s file
I noticed while working on the new IO library that GHC was writing out
the .s file in lots of little chunks.  It turns out that this is a
result of using multiple printDocs to avoid space leaks in the NCG,
where each printDoc is finishing up with an hFlush.

What's worse, is that this makes poor use of the optimisation inside
printDoc that uses its own buffering to avoid hitting the Handle all
the time.

So I hacked around this by making the buffering optimisation inside
Pretty visible from the outside, for use in the NCG.  The changes are
quite small.
compiler/nativeGen/AsmCodeGen.lhs
compiler/utils/Pretty.lhs