-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve compilation time for specific files (ClangBuildAnalyzer report included) #57569
Comments
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 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: