Skip to content

Improvements on readByteString(') by avoid extra allocation#180

Merged
mchav merged 2 commits intoDataHaskell:mainfrom
Eiko-Tokura:eiko
Mar 8, 2026
Merged

Improvements on readByteString(') by avoid extra allocation#180
mchav merged 2 commits intoDataHaskell:mainfrom
Eiko-Tokura:eiko

Conversation

@Eiko-Tokura
Copy link
Contributor

Two more notes:

  • moving chr . fromIntegral from map of IO inside replicateM avoids an extra list allocation. (Because IO is strict and IO of list demonstrate no laziness, it is unclear if ghc can fuse the map inside. We can explicitly fuse it)

  • The use of bracketOnError ensures the buffer is not leaked. This can happen in case of unlucky async exception. Its overhead should be insignificant compared to malloc. If in doubt one, may try to run benchmarks to determine whether it brings overhead.

@mchav
Copy link
Member

mchav commented Mar 8, 2026

Good change. The parquet stuff needs more attention and these kinds of changes are really important. Thank you @Eiko-Tokura

@mchav mchav merged commit acd48c0 into DataHaskell:main Mar 8, 2026
5 of 7 checks passed
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.

2 participants