-
Notifications
You must be signed in to change notification settings - Fork 57
rbx_binary: Interleaved Iterators #545
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
base: master
Are you sure you want to change the base?
Conversation
The &mut self reference must be dropped at the end of the function scope, but it is implicitly captured by the impl.
You're using Nightly. That might explain your performance woes too. |
|
I'm very certain I'm not using nightly. Evidencefn main(){
dbg!(rustc_version::version_meta());
}Installing 1.86 with rustup and building with that shows the same errors as the CI, so it must be something brand new in 1.87. One way to express this in earlier versions would be to spell out the exact type of the returned iterator. |
|
Hmm. You'll have to forgive me, I was out of date on my end as well and the error I got matched the CI error + it said it was an unstable feature so I just assumed. It does appear as though this was stabilized in 1.87.0 and for some reason the version we're downloading in CI is 1.86.0, despite us not pinning a version at all. Unsure what to do about that if anything. Maybe we simply wait patiently for GitHub to update their runners. |
RbxWriteExt::write_interleaved_*#541This makes the interleaved bytes readers and writers work directly with iterators. Many intermediate allocations and copies are omitted, and much of the serialization and deserialization code dealing with interleaved bytes is greatly erginomified. I'm shocked that this wasn't a decent performance uplift, there must be something weird going on. Benchmarks show +6% serialize and +2% deserialize, except the unreliable benchmark which is still random.
As for the unsafe code, I included an equivalent but theoretically slower safe implementation in a comment next to it. The safe implementation benchmarks -1% slower which is within noise.I opted to just use the safe version because the performance impact is negligible.More effort could be put into avoiding intermediate allocations in the
Contentserialize, deserialize, and text_deserializer. If type mismatch errors are dropped, many more optimizations could be made to avoid intermediate allocations.Note: The
write_interleaved_bytes_*functions are implemented ontoChunkBuilderrather thanRbxWriteExtto be able to directly take a&mut [u8]from the output buffer.Edit: Not sure why this is failing to compile on the CI. It builds fine and passes all tests on rustc 1.87. Looks like it has to do with the syntax in 3679993