You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should figure out how to decrease the compilation time of specific C++ files that take the longest to compile. This was measured on an Intel Core i7-6700K:
It seems files generated for embedding binary data take a lot of time to be even read by the compiler. (The time displayed is the sum of all C++ files that included the files in question.)
Is there a way to speed up the embedding of large binary files?
Steps to reproduce
Note: The instructions below are only tested on Linux. Regardless of the operating system, you must use Clang to compile Godot – using GCC or MSVC won't work.
Run the following commands in order (assuming you made the ClangBuildAnalyzer binary executable and moved it to your PATH):
ClangBuildAnalyzer --start artifacts
scons use_llvm=yes CCFLAGS="-ftime-trace" -j$(nproc)# Copy all Clang time trace JSON files to the artifacts directory, so they can be read by ClangBuildAnalyzer.# There will be some naming conflicts, so the report won't be fully accurate.# TODO: Figure out a better way to handle this.
cp ../**/*.llvm.json artifacts -n
ClangBuildAnalyzer --stop artifacts capture_file
ClangBuildAnalyzer --analyze capture_file
The text was updated successfully, but these errors were encountered:
I'm not sure how effective this would be, but perhaps embedding the binary files using the linker would be faster? It would skip the entire stage of parsing the C++ source, which seems to be a place where things slow down. I found a blog post giving a good overview of how to do that, here: https://csl.name/post/embedding-binary-data/
This would be more complicated to do across multiple platforms, but since this would just be doing one very specific function, it shouldn't be too hard to create a script for Godot that takes a binary file, and outputs an object file in the target format, sort of like the Python shader builders. Alternatively, an easier solution would be to include a stripped-down version of https://github.com/netwide-assembler/nasm in Godot, since I believe it supports all the platforms that Godot does.
This would be more complicated to do across multiple platforms, but since this would just be doing one very specific function, it shouldn't be too hard to create a script for Godot that takes a binary file, and outputs an object file in the target format, sort of like the Python shader builders. Alternatively, an easier solution would be to include a stripped-down version of netwide-assembler/nasm in Godot, since I believe it supports all the platforms that Godot does.
This is an interesting idea, but relying on NASM at build-time would require an additional dependency to compile Godot. Also, a different solution is required on ARM. It also wouldn't work for WebAssembly.
Embedding files at link-time is worth pursuing as well, but it's scoped to the linker you're currently using. This means it wouldn't work when using MSVC or for WebAssembly. It may also not work with linkers such as mold (I haven't checked).
Related to #41271 and #42048.
Godot version
4.0.dev (fc09d78)
System information
Fedora 34, Clang 12.0.1, ClangBuildAnalyzer 1.3.0
Issue description
We should figure out how to decrease the compilation time of specific C++ files that take the longest to compile. This was measured on an Intel Core i7-6700K:
It seems files generated for embedding binary data take a lot of time to be even read by the compiler. (The time displayed is the sum of all C++ files that included the files in question.)
Is there a way to speed up the embedding of large binary files?
Steps to reproduce
Note: The instructions below are only tested on Linux. Regardless of the operating system, you must use Clang to compile Godot – using GCC or MSVC won't work.
cd
to the Godot source repository.PATH
):The text was updated successfully, but these errors were encountered: