davidson16807 / tectonics.js

3d plate tectonics in your web browser
http://davidson16807.github.io/tectonics.js/
Creative Commons Attribution 4.0 International
200 stars 28 forks source link

Insane CPU Usage! #62

Open DaTonyCalzone opened 2 years ago

DaTonyCalzone commented 2 years ago

Hello, I was introduced to tectonics.js by WASD20, and I hoping to utilize it for my own made up worlds. But, whenever I load it up, my CPU usage skyrockets to 100%! Because of this, I can't use tectontics.js at all. Is there anyway to improve performance? Reducing resolution didn't help much

davidson16807 commented 9 months ago

Funny you should ask, right around when this was written I had figured out a way to represent grids procedurally, which I expect will significantly help to improve data locality. The problem right now with performance is that there are times where it is absolutely essential for cells to look up properties of grids and their neighbors, which causes an out-of-order traversal through a large patch of memory. I have in the past been able to accurately predict framerates simply by counting the number of times we do this out-of-order traversal. I expect representing grid properties procedurally should dramatically reduce the amount of memory we need to consult during these operations. This is something I've been prototyping on the C++ port but there's a few ways to do it, and my current approach is suffering issues from grid distortion to the point where I don't trust using that implementation, so I have to go back and try a different approach. I expect to work more on that this weekend.