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

Chunk block iter #80

Closed
wants to merge 4 commits into from
Closed

Conversation

ToBinio
Copy link
Contributor

@ToBinio ToBinio commented Apr 9, 2023

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

  • iter var1 - 12 ms
  • iter var2 - 13 ms
  • loop by hand - 1 ms

chunk_block_iter.rs contains 2 Iterators

  • the first tries to be more performent with the help of try_iter_indices()
    • theoretically could be performance wise improved (i think)
  • the second is very simple and just uses block(x, y, z)
    • would work with all chunk types

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.

@ToBinio ToBinio changed the title Chunk block iter Chunk block iter #79 Apr 9, 2023
@ToBinio ToBinio changed the title Chunk block iter #79 Chunk block iter Apr 9, 2023
@owengage
Copy link
Owner

owengage commented Apr 9, 2023

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
Copy link
Contributor Author

ToBinio commented Apr 10, 2023

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

  • iter var1 - 0.5 ms
  • iter var2 - 1 ms
  • loop by hand - 1 ms

@ToBinio
Copy link
Contributor Author

ToBinio commented Apr 10, 2023

change of plans #79

@ToBinio ToBinio closed this Apr 10, 2023
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

Successfully merging this pull request may close these issues.

2 participants