Skip to content

Simplify and speedup compilation database generation#4823

Open
Repiteo wants to merge 6 commits intoSCons:masterfrom
Repiteo:compilation-db-revamp
Open

Simplify and speedup compilation database generation#4823
Repiteo wants to merge 6 commits intoSCons:masterfrom
Repiteo:compilation-db-revamp

Conversation

@Repiteo
Copy link
Contributor

@Repiteo Repiteo commented Jan 31, 2026

Gives the compilation database code some TLC, as the previous implementation caused a lot of --debug=explain output bloat. While I think this will always be an expensive action to some extent, here's an anecdotal comparison of the difference I saw from an MSVC build of the Godot Engine that's already been built:

Method Node Count Build Time
Disabled 17,161 00:16.61
Enabled (Old) 20,008 (+2,847) 00:19.54 (+2.93)
Enabled (New) 17,163 (+2) 00:18.38 (+1.77)

The one area I couldn't figure out was making the entries function as a dependency for the compilation database itself, so it's still set to always build.

Contributor Checklist:

  • I have created a new test or updated the unit tests to cover the new/changed functionality.
  • I have updated CHANGES.txt and RELEASE.txt (and read the README.rst).
  • I have updated the appropriate documentation

@Repiteo Repiteo force-pushed the compilation-db-revamp branch from 9b657fd to cb6b856 Compare February 1, 2026 01:50
@bdbaddog
Copy link
Contributor

bdbaddog commented Feb 1, 2026

Can you give a high level summary of your changes? (But lower than made it faster.. ;)

@Repiteo
Copy link
Contributor Author

Repiteo commented Feb 1, 2026

The most obvious change is the removal of __CompilationDbNode, as that ended up being an unnecessary middleman. I think the original intent was to have those somehow function as dependencies for the compilation database at MongoDB, but they were set to always build since their introduction in this repo, so they were doing extra work for no real benefit. I'm not certain how much faster that specific change ended up being, but it was the reason that the overall amount of nodes decreased by nearly 3k in my test scenario

A secondary boost was from only having to create the commandstr actions once-per-variable. The old implementation was effectively doing a lambda call each time it was validating a commandstr, instead of falling back on a cached function.

Tertiary changes include making the output file always use Unix eol and UTF-8 encoding, as well as using more modern syntax to make some sections less verbose. Also removed the scanner because it did nothing. It quite literally did nothing. It might've at one point in MongoDB, but it was totally vestigial

@bdbaddog
Copy link
Contributor

bdbaddog commented Feb 2, 2026

I'm a bit slammed at the moment and this will take a deeper dive to review, so please be patient for feedback..

@mwichmann mwichmann changed the title Simply and speedup compilation database generation Simplify and speedup compilation database generation Feb 3, 2026
@bdbaddog
Copy link
Contributor

bdbaddog commented Feb 9, 2026

What happens if your build system has more than one Environment()? Seems like with the global gone, it would only output the information for items built with the current Environment()?

@Repiteo
Copy link
Contributor Author

Repiteo commented Feb 9, 2026

Hmm, that's tricky. On one hand, it'd be convenient to allow multiple compiledb outputs based on the environment that called it. On the other hand, that's very much NOT how the current implementation handles it, and I don't want this PR changing observed functionality

I'll go ahead and bring back the global for this PR

Repiteo and others added 2 commits February 9, 2026 15:14
Want to eventually move to a per-environment implementation, but that's beyond the scope of this PR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants