Core: Reduce downstream control.h includers#117950
Core: Reduce downstream control.h includers#117950StarryWorm wants to merge 1 commit intogodotengine:masterfrom
control.h includers#117950Conversation
c680446 to
c2dd6f5
Compare
c2dd6f5 to
873c640
Compare
|
Changelog:
|
|
Great work overall! But seeing the somewhat disappointing results in terms of includers reduction, for a quite significant code churn, I wonder if we're not starting to hit the limits of what we can achieve with forward declares. WDYT @Ivorforce? |
|
I think the big thing holding us up in terms of includes is the variant<->object inclusion. If we could decouple those two, I think that would be the big reduction we are looking for. That, however, unless we are willing to do some pretty ugly changes, is locked behind progress on GDType for Variants. |
|
Regarding how disappointing this change is, I think we need to look at it through the files with meaningful changes, not all the files missing an include or two that needed them added. Yeah, they're still showing churn, but those includes should ideally be there, reduction or not. |
As per Ivorforce's tool,
control.his our 9th most expensive include in terms of compilation.The issue with this header is that what it includes cannot be reduced, and it is used almost universally in editor classes, thus making it very hard to reduce its impact. This PR aims to reduce the number of files that include it transitively as much as possible.
Unlike #117774, I don't have a clean commit history to present, as this one followed a much messier development process (due to how everything downstream of
control.his tangled together). Splitting the results into commits would most likely prevent the engine from compiling if only commits 1 through n are used (out of N). So the result is one big commit.An overwhelming majority of the changes are simple includes additions and forward class declarations, however, this PR did make the following "consequential" changes:
SpinBoxLineEditseparated tospin_box_line_edit.hfromspin_box.heditor_inspector.h&editor_properties.h:EditorPropertymoved toeditor_properties.hEditorPropertyRevertmoved toeditor_properties.hEditorInspectorPluginmoved to neweditor_inspector_plugin.hEditorInspectorDefaultPluginmoved to neweditor_inspector_plugin.hEditorPaginatormoved to neweditor_paginator.hArrayPanelContainermoved to neweditor_array_panel_container.hEditorInspectorActionButtonmoved to neweditor_inspector_action_button.hSome method bodies were also moved from their header file to the implementation file to help:
node_3d_editor_plugin.h: 6 method bodies movedscript_editor_base.h: 1 method body movedanimation_player_editor_plugin.h: 2 method bodies movededitor_audio_buses.h: 1 method body movededitor_help.h: 1 method body movededitor_log.h: 6 method bodies movedSince this PR required quite a lot of analysis to identify what could be reduced, the resulting reports are ~1700 lines long in total. To make it possible for this PR to be editable and load reasonably, you can find the reports in this gist instead:
https://gist.github.com/StarryWorm/f92f3c44f9f1f0b9bacc54fc2c6c1916
Headline stats:
control.hincluders go from 732 total to 676, a meager 56 (or 7.6%) reduction..hand.cppfiles only)The results for
control.hare a bit disappointing, and at this point, I believe there isn't much more reduction possible in that number. However, the reduction in codebase-wide transitives is significant, with about 15 transitives removed on average per modified file (this number shoots up if you only look at files with "consequential" changes).For those who follow these efforts closely: I have learned of quite a few things that can, and will, have automated scripts for. This should make future PRs a lot easier to put together, hopefully helping us achieve our true goal of reducing compile times faster than ever before.
1 with exceptions, primarily regarding exported includes, see IWYU pragmas