Skip to content

Commit 1d94c52

Browse files
authored
Merge pull request #11 from Ivorforce/compile-time-optimization
Add "Compilation time optimization" section to "Optimization guidelines".
2 parents c320fe0 + cc66b90 commit 1d94c52

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

engine/guidelines/optimization.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,23 @@ desktop, and the more platforms, the better.
149149
In particular, you should be aware that changes which increase performance on one platform
150150
can often reduce performance on another.
151151

152+
Compilation time optimization
153+
-----------------------------
154+
155+
Optimizing compile time can be a worthwhile goal, because it improves how easy it is to
156+
work on the Godot codebase, especially for people with older hardware. Godot's compile time
157+
is `monitored and tested every day <https://benchmarks.godotengine.org/graph/build-time/>`__.
158+
159+
Like with all optimization efforts, it is essential to focus on parts of the build system
160+
that have a large impact on compile time. This is not possible without profiling the
161+
compiler.
162+
163+
SCons, the build system that Godot is using, does not currently support profiling.
164+
However, it is possible to use `compile_commands.json <https://docs.godotengine.org/en/latest/engine_details/development/configuring_an_ide/index.html#doc-configuring-an-ide>`__
165+
to isolate a single compile step to profile. In gcc/clang, you can profile using
166+
the ``-ftime-trace`` argument, while in MSVC, this is accomplished using ``vcperf``'s
167+
``/timetrace``.
168+
169+
In addition, we have a tracker that analyzes all time traces to estimate which headers should be
170+
investigated to improve overall compile time. You can find this tracker on the Godot repository:
171+
`[TRACKER] Compile time issues <https://github.com/godotengine/godot/issues/111218>`__.

0 commit comments

Comments
 (0)