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

Determine Frustum Set function preformance #88

Closed
gkjohnson opened this issue Jul 10, 2020 · 1 comment · Fixed by #90
Closed

Determine Frustum Set function preformance #88

gkjohnson opened this issue Jul 10, 2020 · 1 comment · Fixed by #90

Comments

@gkjohnson
Copy link
Contributor

The determineFrustumSet function seems to dominate time in terms of update function time. See if we can improve performance.

@gkjohnson
Copy link
Contributor Author

On a large dataset determineFrustumSet is taking 1.03ms out of 1.35ms time for update. LRUCache.markUsed seems to take a large chunk of that time, too. Removing the indexOf, splice, and push array operations seems to improve things quite a bit.

Solution

We should remove the splicing and updating of the itemList array in markUsed and instead sort the array into the appropriate order only when we need to in unloadUnusedContent. We should always sort and only use unloadPriorityCallback when it's available. If it's not available we should sort by "last used time" such that the most recently used items (but currently unused) are first in the array after the currently used items. The last used time can be bookkept in a usedMap (which can replace usedSet). This should keep the behavior the same but defer the array update until necessary and the sort itself should be faster than array splicing.

Note

DetermineFrustumSet is still the dominating function in update. The rest can probably be attributed to the frustum and error calculations. There may be ways to improve those functions, as well.

@gkjohnson gkjohnson added this to the Next Release milestone Jul 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant