Skip to content

Apply IWYU suggested header changes#76

Merged
Maxxen merged 2 commits intoduckdb:mainfrom
dentiny:hjiang/apply-iwyu-storage-2
Jan 23, 2026
Merged

Apply IWYU suggested header changes#76
Maxxen merged 2 commits intoduckdb:mainfrom
dentiny:hjiang/apply-iwyu-storage-2

Conversation

@dentiny
Copy link
Copy Markdown
Contributor

@dentiny dentiny commented Jan 19, 2026

Hi team, I would like to do a header file cleanup to improve compilation speed (example).
One issue I've found is, since there's transitive inclusion for VSS extension, one of the CI pipeline fails due to changed and missing declaration: https://github.com/dentiny/duckdb/actions/runs/21146969482/job/60814732856

In this PR, I use IWYU to detect issues, which includes missing and extra header files, and use cursor to apply all these changes. This PR is overall a no-op change.

@Maxxen
Copy link
Copy Markdown
Member

Maxxen commented Jan 19, 2026

Cool! I tried to use IWYU before on the core repo but gave up since it didn't seem to work too well on macOS (ended up including a bunch of internal system headers instead of the std headers).

If you want to improve compile speed further you might also want to look into putting local classes with methods into anonymous namespaces / add more static declarations. I did that a while ago and while I didn't measure the compile speed I managed to reduce the final binary size quite a bit (~2mb). I also added a tidy-rule for it but it seems like it somehow doesn't trigger in CI, idk, but maybe there is a way to write a script or something to detect symbols that can safely be moved to static linkage (at least my IDE seems to complain).

@Maxxen Maxxen merged commit 590d53b into duckdb:main Jan 23, 2026
22 checks passed
@dentiny
Copy link
Copy Markdown
Contributor Author

dentiny commented Jan 23, 2026

Hi @Maxxen thanks for the reply!

I ran a IWYU against the codebase on ubuntu a while ago, which emits over 60K lines of suggested change, definitely sth I don't want to do manually without auto-fix or agent involvement. :(

ended up including a bunch of internal system headers instead of the std headers

Yes, IWYU doesn't seem to smart enough to handle STL libraries, I made a formal PR here, which I explicitly tell the agent to ignore system and STL libraries. Feel free to leave any comments!

@Maxxen
Copy link
Copy Markdown
Member

Maxxen commented Jan 23, 2026

Yeah this is probably a pretty good use case for agents haha, good work regardless!

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.

2 participants