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

Bigstring support for binary converters #73

Open
tomjridge opened this issue Sep 2, 2021 · 2 comments
Open

Bigstring support for binary converters #73

tomjridge opened this issue Sep 2, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@tomjridge
Copy link

Jane Street bin_prot uses Bigstring as the target buffer type. This is useful for working with C libraries, mmaps etc. For binary converters, we can avoid intermediate buffers if we have an interface that takes the position in the Bigstring to read/write from (rather than converting to string each time).

In short, this is a request for Bigstring support with a different interface than currently is used for encode_bin and decode_bin.

@tomjridge
Copy link
Author

For even better performance, I think read takes a "int ref" as the position to read from. This avoids allocating a pair for the return type (the next position to read is updated via the int ref). Hope this makes some kind of sense.

@craigfe
Copy link
Member

craigfe commented Sep 6, 2021

This is a good idea & should be pretty straightforward thanks to the recent refactoring to extract binary_codec.ml.

We should be sure that whatever solution we have using refs is multicore-compatible. Other than that it seems best to allocate as rarely as possible.

@craigfe craigfe added the enhancement New feature or request label Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants