Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hPutStr NoBuffer uses base hPutChar for Every Character #584

Closed
BebeSparkelSparkel opened this issue Apr 21, 2024 · 2 comments
Closed

hPutStr NoBuffer uses base hPutChar for Every Character #584

BebeSparkelSparkel opened this issue Apr 21, 2024 · 2 comments

Comments

@BebeSparkelSparkel
Copy link
Contributor

BebeSparkelSparkel commented Apr 21, 2024

I was looking at creating a PR for #446 and noticed that for strict text hPutStr the base function GHC.IO.Handle.Text.hPutChar which has a lot of overhead and repeats much work for every character that Data.Text.IO.hPutStr has already done. Is this something that could be improved upon?

This also seems to be the case with lazy text hPutStr except that it repeats work for every chunk instead of every char.

@Bodigrim
Copy link
Contributor

NoBuffering mode is meant to be slow. It does not bear much practical significance, because compiled code uses LineBuffering by default.

@BebeSparkelSparkel
Copy link
Contributor Author

I see that now in ghc-internal

            hPutChars handle str        -- v. slow, but we don't care

https://gitlab.haskell.org/ghc/ghc/-/blob/master/libraries/ghc-internal/src/GHC/Internal/IO/Handle/Text.hs#L655

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

No branches or pull requests

2 participants