-
Notifications
You must be signed in to change notification settings - Fork 102
Only call getsectiondata()
once per image.
#734
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
Conversation
This PR improves the performance of test discovery by only calling `getsectiondata()` once per loaded image instead of twice. It also refactors the C++ platform-specific enumerator function to take a new structure, `SWTSectionBounds`, instead of multiple arguments. This lets us use a C++ range-for-loop (`for (const auto& record : sectionBounds)`) instead of a raw C for-loop, reduces register traffic on Windows, and is all around a bit more object-oriented (which I hope is an improvement, yeah?) A non-scientific comparison at my desk shows that, before the change, **cold** test discovery on macOS took an average of 0.0376 seconds. After the change, the average was 0.0217 seconds for an approximate 1.73x speedup.
@swift-ci test |
@@ -392,27 +416,27 @@ static void enumerateTypeMetadataSections(const SectionEnumerator& body) { | |||
// Look in all the loaded modules for Swift type metadata sections and store | |||
// them in a side table. | |||
// | |||
// This two-step process is less algorithmically efficient than a single loop, | |||
// but it is safer: the callback will eventually invoke developer code that | |||
// This two-step process is more complicated to read than a single loop would |
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.
Technically it's O(n) either way, so it's not algorithmically more complex, but it is longer code.
… address anyway (and I knew that, what was I doing?)
@swift-ci test |
@swift-ci test |
@swift-ci test |
#else | ||
using SWTMachHeaderList = SWTVector<const mach_header *>; | ||
#endif | ||
|
||
/// Get a copy of the currently-loaded Mach headers list. |
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.
Any of these docs need to be updated to reflect the new "section bounds" instead of "headers lists" terminology?
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.
Yeah I'll do a quick pass before I merge.
@swift-ci test |
This PR improves the performance of test discovery by only calling
getsectiondata()
once per loaded image instead of twice. It also refactors the C++ platform-specific enumerator function to take a new structure,SWTSectionBounds
, instead of multiple arguments. This lets us use a C++ range-for-loop (for (const auto& record : sectionBounds)
) instead of a raw C for-loop, reduces register traffic on Windows, and is all around a bit more object-oriented (which I hope is an improvement, yeah?)A non-scientific comparison at my desk shows that, before the change, cold test discovery on macOS took an average of 0.0376 seconds. After the change, the average was 0.0217 seconds for an approximate 1.73x speedup.
Checklist: