ultimatexr-unity icon indicating copy to clipboard operation
ultimatexr-unity copied to clipboard

Improved CPU performance

Open smitdylan2001 opened this issue 2 years ago • 2 comments

Improved CPU performance with different fixes. Some more important than others (SetPositionAndRotation should ALWAYS be used for example)

  • Use SetPositionAndRotation instead of double transform call
  • Re ordering vector calculations
  • Merged if/else return into return
  • Merged if/else bool into direct bool set
  • Use TryGetComponent to avoid garbage allocation
  • Use native .Count/.Length instead of LINQ alternative
  • Improve string comparison
  • Use AddRange
  • Use Color32 when setting pixels

smitdylan2001 avatar Sep 20 '22 14:09 smitdylan2001

Hey Dylan. Hoping that gets merged! Thanks again for posting those Unity project templates for accelerated Quest performance.

01GOD avatar Sep 26 '22 07:09 01GOD

Thanks a lot @smitdylan2001! Will be reviewed and merged in the next update.

entromp avatar Oct 10 '22 11:10 entromp

Thanks a lot @smitdylan2001! Will be reviewed and merged in the next update.

Any update on the merge?

smitdylan2001 avatar Nov 13 '22 15:11 smitdylan2001

I've reviewed and tested the PR and merged with some key changes in main that were made meanwhile. Everything seems to work correctly, and some suggested patterns have been noted.

Thanks for the contribution!

entromp avatar Nov 28 '22 07:11 entromp