Skip to content

Conversation

@BebeSparkelSparkel
Copy link
Contributor

No description provided.

@Lysxia
Copy link
Contributor

Lysxia commented Jun 3, 2024

You need to also add Lazy.streamLn for putStrLn, to not undo #600 (previous version of #600 that did this: master...Lysxia:text:atomic-putStrLn-2#diff-edae5dcf8eddff52ec5d211ae61c79a2398da37f0798e3eb96a9207f3272c2e2R135)

@Bodigrim
Copy link
Contributor

Bodigrim commented Jun 3, 2024

What's the motivation for this change? Is it for performance?

@Lysxia
Copy link
Contributor

Lysxia commented Jun 3, 2024

Yes, for performance, by avoiding duplicate work in accessing the Handle for every chunk. Also more atomicity: the current implementation makes one Strict.hPutStr call per chunk, this PR appends chunks together into one line/block buffer before committing them. It's a continuation of #592.

@Bodigrim
Copy link
Contributor

Bodigrim commented Jun 4, 2024

Also more atomicity: the current implementation makes one Strict.hPutStr call per chunk, this PR appends chunks together into one line/block buffer before committing them.

This seems to defeat the purpose of lazy Text, no? We do not want to append chunks together, because it would cause excessive memory consumption.

@Lysxia
Copy link
Contributor

Lysxia commented Jun 4, 2024

The idea is that the buffer is bounded. This only happens if the chunks are smaller than the block size determined by the buffering mode.

@BebeSparkelSparkel
Copy link
Contributor Author

We do not want to append chunks together

There is no appending of chunks; only copying to a pre-allocated character buffer.

BebeSparkelSparkel and others added 2 commits June 6, 2024 09:02
Co-authored-by: ˌbodʲɪˈɡrʲim <[email protected]>
@Bodigrim Bodigrim requested a review from Lysxia June 22, 2024 23:09
@Bodigrim Bodigrim merged commit 3cd9ed3 into haskell:master Jun 25, 2024
@Bodigrim
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants