[Haskell-cafe] memory issues
daniel.is.fischer at web.de
Sat Feb 28 10:20:09 EST 2009
Am Samstag, 28. Februar 2009 09:38 schrieb Bulat Ziganshin:
> Hello Daniel,
> Saturday, February 28, 2009, 3:10:44 AM, you wrote:
> >> print may waste a lot of time, locking stdout for every
> >> line printed
> > hout <- openFile (args!!1) WriteMode
> > mapM_ (hPrint hout) $ sort $ blocks content
> > ? I find hardly any difference, though.
> no difference. if handle is locked for every output operation - both
> versions will be equivalent. if not - they also will be equivalent :)
But they would not be equivalent if stdout has to be locked for each output
operation separately, but a file opened with openFile fp WriteMode was
locked then once and remained so until closed.
Since I don't know the internals, I thought it was worth taking a look.
Seems they behave the same.
More information about the Haskell-Cafe