-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
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
Don't include core/io/image.h
in core/os/os.h
#98237
Don't include core/io/image.h
in core/os/os.h
#98237
Conversation
0a403fe
to
6d22368
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a compiler update, if it passes Github actions cicd it's fine.
I don't expect a speedup but it's neat on a clarity point of view.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be safe, only risk is obscure compile errors in classes using Ref<Image>
, did you cover all such cases specifically? If so then this should be proof against future changes and the only real risk is existing PRs that would need to be adjusted
I honestly doesn't know anything about |
This include is likely an old one from 3.x, a bunch of |
The issue is explained here #80330 (comment) |
Honestly I can't say that I really understand I removed forward declaration of |
Are you sure there are no places that used to include this that have |
It looks like there are some places where the potential problem exist. I am almost found an easy way to find them with |
`core/os/os.h` doesn't use `core/io/image.h`. It just brings transitive dependencies. Lots of dependencies because `core/os/os.h` is transitively included in almost every file of godot Also added `core/io/image.h` into files^1 where `Ref<Image>` and `core/os/os.h` were used to prevent obscure errors involving `Ref<Image>` ^1 except those which include `core/io/image_loader.h` or `core/io/image.h` by corresponding .h file with the same name Signed-off-by: Yevhen Babiichuk (DustDFG) <dfgdust@gmail.com> Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
6d22368
to
af6d260
Compare
Now I am sure. Though I didn't add it to the files which include |
Thanks! |
core/os/os.h
doesn't usecore/io/image.h
It just brings to the code base transitive dependencies. Lots of dependencies because
core/os/os.h
is transitively included in almost every file of godotHow numbers were obtained. First of all thanks to this message in chat I knew about
--tree=linedraw
. So after compiling I runscons --tree=linedraw > /tmpt/godot.linedraw
after that I needed to get actual number of includes of tested files. By runninggrep "<file>" /tmp/godot.linedraw | wc -l
you get a number of files which directly or transitively depend on<file>
core/os/os.h
core/io/image.h
Summary. With this PR compiler will need to process
core/io/image.h
423 times less. Numbers were obtained on linux and will differ a little on different platforms because they doesn't share files insideplatform
folder.It definitely should improve compilation speed but how much.... Maybe several microseconds, maybe several minutes. I can't check. One full build build from clean state takes 1.5~ hours on my machine so if you have a more powerful machine, could you please test if there is difference in compile times?
This PR also contains one minor change.
core/core_bind.h
didn't usecore/io/image.h
in any way as like all who includes it so this change doesn't dependcore/os/os.h
file