-
Notifications
You must be signed in to change notification settings - Fork 56
Description
I started using Kaitai two years ago when it was still version 0.8. After a long project hiatus I've now upgraded to 0.10 and noticed that the read_bytes(char*, std::streamsize)
variant was removed. This is an issue for writing code that tries to avoid excessive memory allocations.
For the binary format I'm reading, Kaitai allocates a lot of small memory blocks and I ran into a "death by a thousand cuts" situation where parsing was extremely slow due to all those allocations. So I wrote a custom type that preallocated memory for certain regions of the file and parsing basically became instant.
Now that the char*
variant of read_bytes
was removed, I'm back to square one, unfortunately, and I can't avoid allocating memory when reading a block of bytes because I can only receive a new std::string
instance as a return value.
Why was this decision made and could this be reversed?
Thank you!