-
Notifications
You must be signed in to change notification settings - Fork 80
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
Improve compilation times on Windows #172
Improve compilation times on Windows #172
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking the time to contribute! Header hygiene is always appreciated, as is tidying up includes. I definitely agree there's a lot more that can be improved 😄 I have a small handful of comments, mostly straightforward
struct object_frame; | ||
struct safe_object_frame; | ||
|
||
using frame_ptr = std::uintptr_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we #include <cpptrace/cpptrace.hpp>
here instead. My main concern is this falling out of line with the definition there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I measured this change making a noticeable difference via ClangBuildAnalyzer
. If there is a mismatch between these forward declarations and cpptrace.hpp
, compilation will fail with an hard error (i.e. you won't silently introduce any UB).
Given that, would you reconsider?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that’s reasonable, I appreciate you measuring. I had also been thinking of splitting ip the cpptrace.hpp file so one option in the future might be to have a more minimal header providing the type.
@@ -16,6 +16,7 @@ | |||
#include <link.h> // needed for dladdr1's link_map info | |||
#endif | |||
#elif IS_WINDOWS | |||
#define WIN32_LEAN_AND_MEAN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it'd be worthwhile to just do target_compile_definitions(... PRIVATE WIN32_LEAN_AND_MEAN)
?
Looks like some CI is failing, unfortunately one of the hard things about developing this library is how much code can't be tested on a single platform. Happy to help however I can. |
@jeremy-rifkin: could CI be retriggered, please? |
@jeremy-rifkin: and again please :) If possible, could you make CI not require approval until this PR is merged? I need to iterate a bit to figure out what includes are missing on various platforms. |
I’ll look to see if I can set it to not need approval, sorry for the iteration hassle |
Seems like approval is still required :( |
Sorry for the hassle here, I think the setting is correct now. I can take a stab at getting things correct later too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again so much for the contribution, taking the time to do this, and putting up with all the iteration pain. I went ahead and added a couple commits to get remaining stuff working. Everything here LGTM, thanks again!
Thank you for the very useful library!
Few improvements:
windows.h
to.cpp
whenever possibleWIN32_LEAN_AND_MEAN
Tested on Windows with
There's a lot more that can be improved if you are interested.