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

Encoders based on [Bytes]IO instead of string joining? #199

Open
janpipek opened this issue Sep 19, 2020 · 0 comments
Open

Encoders based on [Bytes]IO instead of string joining? #199

janpipek opened this issue Sep 19, 2020 · 0 comments

Comments

@janpipek
Copy link
Contributor

Hi Ilya,

after some time, I finally got some time to follow up on the streaming support we introduced last year (in #174 ). I started thinking how to best inject a BinaryIO into the encoding project. I can give it a try but before changing any code, I realized one (rather positive) thing:

For huge objects, encoding is much less problematic than decoding. There is some necessary copying of strings on each level of the structure but on the lower levels, only very small strings are copied, theoretically making the total asymptotic time something like O(total_size * depth_of_hierarchy) instead of O(totalsize^2) (which was the case of decoder).

However in practice, with a toy example, I was not able to even make it worse than linear - Sequence of sequences of 1000x1000 objects cost ~ the same as one sequence of 1,000,000 objects and that cost ~100 times more than one sequence of 10,000 objects. Perhaps some time might be spared by using one output stream but on the expense of passing this object all around in the encoding process. What are your thoughts?

Best regards,
Jan

@janpipek janpipek changed the title Encoders working with IO instead of string addition? Encoders working with IO instead of string joining? Sep 19, 2020
@janpipek janpipek changed the title Encoders working with IO instead of string joining? Encoders based on StringIO instead of string joining? Sep 19, 2020
@janpipek janpipek changed the title Encoders based on StringIO instead of string joining? Encoders based on [String]IO instead of string joining? Sep 19, 2020
@janpipek janpipek changed the title Encoders based on [String]IO instead of string joining? Encoders based on [Bytes]IO instead of string joining? Sep 19, 2020
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

1 participant