-
Notifications
You must be signed in to change notification settings - Fork 28
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
Poor performance when reading primitive types that aren't UInt8? #106
Comments
The allocation happens here: https://github.com/JuliaLang/julia/blob/c094a89b9bf5ae9dccbf5d85c3925d619cfe1dcf/base/io.jl#L766, because in order to read from a stream julia allocates a Also, while At least on my machine, reading from This is the relevant stacktrace I'm getting with
|
I am trying to read some data in a looping way, reading a mix of primitive types. Here's a simple MWE where I am just reading Int32s:
This produces an allocation per
read
call, which becomes very slow in a tight loop! Reading 4 million UInt8s (see commented out line) has effectively zero allocations in the loop.Is this expected behavior? Is my use-case uncommon? It does not seem to be specific to the
NoopStream
, since I first encountered it with theCodecZstd.ZsdtDecompressorStream
.Thanks.
The text was updated successfully, but these errors were encountered: