Skip to content

Conversation

@jonathoncobb
Copy link
Member

Overview

The SpherePointer performs multiple queries per frame at times and with every collider returned it performs a costly GetComponent call on the collider to retrieve the NearInteractionGrabbable component.

Changes

This PR optimizes that logic by adding a LRU cache to the SpherePointer to cache the retrieved NearInteractionGrabbable component. The cache holds a user defined number of entries, and the cache is purged when the SpherePointer is destroyed.

Editor mode unit tests are implemented for the new utilities class LRUCache.

@jonathoncobb jonathoncobb force-pushed the jonathoncobb/query-caching branch from 8c66491 to c61c68d Compare November 17, 2021 23:18
The SpherePointer performs multiple queries per frame at times and with every collider returned it performs a costly GetComponent call on the collider to retrieve the NearInteractionGrabbable component.

This PR optimizes that logic by adding a LRU cache to the SpherePointer to cache the retrieved NearInteractionGrabbable component. The cache holds a user defined number of entries, and the cache is purged when the SpherePointer is destroyed.

Editor mode unit tests are implemented for the new utilities class LRUCache.
@jonathoncobb jonathoncobb force-pushed the jonathoncobb/query-caching branch from c61c68d to 31e4bb1 Compare November 17, 2021 23:53
@RogPodge RogPodge changed the base branch from main to prerelease/2.8.0 May 13, 2022 18:25
@RogPodge
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@RogPodge
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@RogPodge
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@keveleigh
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@RogPodge RogPodge merged commit 40894a6 into microsoft:prerelease/2.8.0 May 16, 2022
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.

4 participants