owengage / fastnbt

Fast serde serializer and deserializer for Minecraft's NBT and Anvil formats
MIT License
185 stars 35 forks source link

Chunk block iter #80

Closed ToBinio closed 1 year ago

ToBinio commented 1 year ago

I tried creating a chunk-block-iter and honestly struggelt... but i finaly got a pretty stupid version running for the CurrentJavaChunk... but the performance is questionable.

just a small warning this code is a mess. Dont worry it well get better.


iter-chunk-blocks.rs is a small exmaple (currently test) file. It containes 3 simple loops and messures very simple the performance. times on my machine with --release


chunk_block_iter.rs contains 2 Iterators


i dont know if i am using rusts Iterator Trait wrong but it feels like the performance overhead is to big.

maby i am also missing some major point to improve iter var1.

owengage commented 1 year ago

I've not looked closely, but your performance difference may be down to the raw loops only taking a reference to the block in the palette, whereas the iterator clones the block, which will involve cloning a string.

ToBinio commented 1 year ago

Oh. Wow i did not expected that to make such a big difference... new times:

ToBinio commented 1 year ago

change of plans #79