How to optimise Debug.assert #5473
mvaligursky
started this conversation in
General
Replies: 3 comments 3 replies
-
@willeastcott @slimbuck @kungfooman - thoughts? |
Beta Was this translation helpful? Give feedback.
1 reply
-
@kungfooman - thanks! Yes, that was the first idea I looked at (and ChatGPT suggested), but it didn't feel clean enough, but perhaps it's fine. At the moment it feels a lot better than the suggestion I had in the initial post. Any other ideas? If not, I'll go ahead with this I think. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Yep agree with @kungfooman 👍🏻 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
currently we have this implementation
And typically it's called like this:
The problem here is that the templated string gets expanded before being passed to the assert function, which is expensive if this call is used in hot functions - we get lots of string concatenations.
Ideally, this would only take place when the assertion condition is false, which is when the string is logged out.
What are the options?
One I see is this:
which works, but gives me this lint warning:
Is there something better?
Beta Was this translation helpful? Give feedback.
All reactions