fenomas / noa

Experimental voxel game engine.
MIT License
611 stars 87 forks source link

Reduce number of allocations when merging submeshes #105

Closed Jarred-Sumner closed 4 years ago

Jarred-Sumner commented 4 years ago

This is a follow up from #96.

This code:

I manually tested it works by walking around on a big map and running the profiler in Chrome. The profiler was run in the same spot with the same settings after page load.

Before: image

After: image

Additionally, I added a .prettierignore file because when I first saved, it created a really big formatting diff from prettier which would make it more difficult for you review.

I haven't really measured the impact of the second commit, but using for loops instead of .map is known to make stuff a little faster according to a bunch of blog posts with microbenchmarks that sound kind of unconvincing