jonhoo / async-bincode

Asynchronous access to a bincode-encoded item stream.
Apache License 2.0
68 stars 9 forks source link

Only buffer one item at a time, prevents unbounded memory usage #12

Closed xmakro closed 1 year ago

xmakro commented 1 year ago

Resolves https://github.com/jonhoo/async-bincode/issues/11

jonhoo commented 1 year ago

Ah, you may also need to update the tests in src/lib.rs so that they use a BufWriter, since currently they end up running very slowly.

jonhoo commented 1 year ago

Oh, just FYI, I also updated the CI configuration on main (now renamed from master), so you may want to rebase on top of that (but it's not necessary if you don't feel like it :) )

xmakro commented 1 year ago

Thank you Jon. I updated branch and fixed a missing poll_write inside poll_flush. I added BufStream to the bigger tokio test, but not to the futures-io one as it would make the code more complicated since they only have separate BufWriter/BufReader and not the BufStream. All tests run in 0.22s in fastbuild and 0.1s in release mode, hope that is fine. Please take another look before merging and thank you very much for the quick turn around!

jonhoo commented 1 year ago

Released in 0.7.1 — thanks for taking the time to go through all the steps of this!