-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use math builtins instead of <math.h>
if available
#8467
base: master
Are you sure you want to change the base?
Use math builtins instead of <math.h>
if available
#8467
Conversation
Thanks for your PR! It's interesting to know that this is possible. I'm slightly interested in potentially it affecting Debug Codegen, more than compile time since imgui_internal.h is not particularly often included in user's codebases. My gut intuition is that the slight visible cruft/bloat and potential maintenance may rub me off, but I'll look at this more closely at some point. (Don't expect it to be soon as I'm in a permanent state of death by thousands cuts with issues/pr, if I treat all the very peripheral stuff like that I'm never moving forward with bigger stuff). |
No worries, let me know if you want me to take a stab at cleaning it up to minimize the cruft/bloat! :) |
Wouldn't |
Nope, even with |
Hmm, that's with (the only difference on GCC is between |
My bad, sorry! I didn't expect that choosing between I wonder if this is an optimization applied in the compiler frontend as a special case, or if something else is going on... |
Approaching compile-time micro-optimization territory here, but this reliably shaves off 40-50ms of build time in any TU that includes
imgui_internal.h
on my system. As an added benefit, we also avoid exposingmath.h
to those TUs, any potentially improve debug codegen a little bit.Both GCC and Clang on my system have all the required builtins. I don't use MSVC.
If the PR is deemed worthwhile, I will clean-up the PR to avoid the code repetition and improve formatting. Otherwise, feel free to close -- no hard feelings!