d.healey last edited by
Is there an efficiency loss using getComponent throughout a script instead of using it once in on init and storing the component in a const and using the const throughout?
Christoph Hart last edited by
You can measure the efficiency loss with
Console.stop(). Be aware that this operation has O(n) complexity, so it will increase for bigger projects.
As a general rule of thumb I would suggest to keep a reference around for events that are often triggered (or if they are in the MIDI callback then it's out of the question to call the method obviously), but if it's being used just when the user presses a button, the additional 2-3 milliseconds it will take won't be noticeable.