Skip to content
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

Build perf: Make calls to bindgen run in parallel #159

Merged
merged 7 commits into from
May 29, 2024

Conversation

NateD-MSFT
Copy link
Contributor

When compiling this repo (or projects that depend on it), a large portion of the build time is spent waiting for bindgen to finish constructing bindings to the WDK. This can severely slow down iterative development and builds.

This PR makes a simple change to how we call bindgen by calling each function wrapping a call to it in parallel. On my machine this provides a speedup of running "cargo make" in windows-drivers-rs of about 20% (~500 seconds run time to ~400 seconds).

I wouldn't be surprised if we can refactor the calls even more to see greater speedups, but this was just a quick late afternoon project to speed up work on other features.

wmmc88
wmmc88 previously approved these changes May 17, 2024
Copy link
Collaborator

@wmmc88 wmmc88 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pr speeds up the build by parallelizing the generation of the bindings in outdir and in the generated_bindings folder. The latter was only added since it was easier to get diffs between prs when there are bindgen changes. I have a pr that removes this duplicate generation (since that pr also introduces feature in #82 so it doesnt make sense to only look at the km bindings diff).

I have written a cargo make task that will generate these binding diffs, and will clean it up and pr in the near future

I am still good to merge this until that lands

crates/wdk-build/src/bindgen.rs Show resolved Hide resolved
crates/wdk-sys/build.rs Outdated Show resolved Hide resolved
This is a little silly with all the clones, but it works.
@wmmc88 wmmc88 added this pull request to the merge queue May 29, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 29, 2024
@wmmc88 wmmc88 added this pull request to the merge queue May 29, 2024
Merged via the queue into microsoft:main with commit 793a270 May 29, 2024
49 checks passed
@wmmc88 wmmc88 mentioned this pull request Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants