opensim-org / opensim-core

SimTK OpenSim C++ libraries and command-line applications, and Java/Python wrapping.
https://opensim.stanford.edu
Apache License 2.0
800 stars 323 forks source link

Add if check before calculating strings for log_debug #3963

Closed adamkewley closed 1 week ago

adamkewley commented 1 week ago

Fixes issue N/A

Noticed that debug logging takes a bit of CPU during assembly - even if the log is disabled. Turns out, it's because log_debug etc. aren't macros and, therefore, fully evaluate all arguments before forwarding to the logger. If the logger doesn't need to sink the resulting message, then the evaluation is wasted.

Brief summary of changes

Testing I've completed

Looking for feedback on...

CHANGELOG.md (choose one)


This change is Reviewable