rojo-rbx / rbx-dom

Roblox DOM and (de)serialization implementation in Rust
MIT License
105 stars 42 forks source link

Use generic interleaving methods for `rbx_binary` core #330

Closed Dekkonot closed 11 months ago

Dekkonot commented 11 months ago

This migrates the various read_interleaved_XXX_array and write_interleaved_XXX_array functions to use read_interleaved_bytes and write_interleaved_bytes respectively.

The end result is a lot simpler code and has no cost associated with it (I checked the assembly, both versions give us basically the same instructions). Benchmarking also supports this, as the compilation time on my machine is basically the same before and after once you account for noise.

Also I added documentation to all these functions and the integer transforming functions because I didn't like them sitting there undocumented.

kennethloeffler commented 11 months ago

Massive nit:

The commit message is going to be 93 characters long (21 more characters than the recommended 72) when this gets merged... can you edit the title of this PR so it's more concise, maybe Use generic interleaving methods in rbx_binary core?

Dekkonot commented 11 months ago

Just for you, yes, I can