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

New module to export the untagged_read/write functions #7

Open
UnixJunkie opened this issue Mar 7, 2013 · 2 comments
Open

New module to export the untagged_read/write functions #7

UnixJunkie opened this issue Mar 7, 2013 · 2 comments

Comments

@UnixJunkie
Copy link
Contributor

Hello,

I think it may be useful to have a module
so that people can directly read/write
untagged values, without
having to go through biniou's output buffer
(and associated data copy).

Instead of using an output buffer, these
functions would take an in or out_channel.

I'd like to expose in such module all the
read/write_untagged_* functions but
using channels for these ones.

Regards,
F.

@mjambon
Copy link
Member

mjambon commented Mar 10, 2013

It's a matter of performance (how to write say 4 bytes to a channel but perform only one bound check internally?), and also reusability (can't use channels for writing to string or to an arbitrary buffer).

Did you take a look at Bi_outbuf.create_channel_writer and Bi_inbuf.from_channel?

@UnixJunkie
Copy link
Contributor Author

Bi_outbuf.create_channel_writer

Yes, I saw the make_room function can write to an output channel.

Wouldn't it be possible to use a functor to have the read/write_untagged_* functions
either work with a biniou in/out_buffer or an in/out channel?

I still think the read/write_untagged_* functions are useful even outside of biniou's context.
Pervasives from stdlib provides output_binary_int and input_binary_int but nothing
for floats for example.

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