afonsolage / projekto

Voxel game made with Bevy Engine
MIT License
59 stars 4 forks source link

Rework of merge_faces #27

Closed afonsolage closed 2 years ago

afonsolage commented 2 years ago

Fixes #26

I moved all merge_faces related code to a new mod (faces_merger), in order to have better organization. Also since merge_faces is a critical function, I'm adding a bunch of tests to ensure everything is working fine.

Right now I've managed to get merge_face_right passing, need to add and pass others.

afonsolage commented 2 years ago

It's almost done, just needs to fix a new issue:

image

afonsolage commented 2 years ago

Just some final optimizations, since this function is very CPU consuming.

Initial benchs:

merge_faces_empty_chunk      ... bench:   5,676,345 ns/iter (+/- 249,641)
merge_faces_half_empty_chunk ... bench: 128,743,100 ns/iter (+/- 14,071,211)
merge_faces_half_full_chunk  ... bench: 262,783,770 ns/iter (+/- 55,934,044)
merge_faces_worst_case       ... bench: 248,931,670 ns/iter (+/- 2,826,090)
afonsolage commented 2 years ago

I wasn't able to do much. Tried many strategies but no real gain.

So I'll merge it.