-
-
Notifications
You must be signed in to change notification settings - Fork 22.5k
Replace VMap
used in VisualShader
with HashMap
and remove VMap
#100446
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
Conversation
Found this while cleaning my stale PRs. Seems nobody really cares |
VMap
used in VisualShader
with HashMap
VMap
used in VisualShader
with HashMap
and remove VMap
Yeah if there's no downside to moving to HashMap, I'm fine with removing VMap. CC @godotengine/core This technically breaks compatibility for thirdparty C++ modules which may rely on it, but if they do they can simply copy the |
It's a good candidate for removal. I'll bring it up at the next core meeting. |
We discussed this proposal in the core meeting. We agreed that generally, this is a good idea, and if we proceed with it there's it's fine to remove However, given that this deals with shaders, we need to be very sure that this PR that this PR doesn't cause performance regressions, so benchmarking it is absolutely needed for it to be merged. Personally, I'd try to familiarize myself with visual shaders enough to get a feeling for how to benchmark it, then benchmark it in place with a very demanding task. Perhaps someone from @godotengine/shaders has any tips? :) It may also be enough to show that the code isn't called often and is thus risk-free, but one use is in |
I took some time to familiarize myself with VisualShader and ran a simple stress test. My conclusion is that I commented out these lines, forcing Profiling results show that most of the time is spent on shader compilation rather than the VisualShader-to-Shader conversion. Even within the conversion process, Test project: test_visual_shader.zip I have difficulty finding or creating complex visual shaders (the code seems clever enough to skip disconnected nodes so I can't just add bunches of nodes). If someone can provide a complex shader I'm happy to test it. |
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.
Let's go ahead with it, sufficient testing was done IMO and we can always reconsider if users report regressions.
Thanks! |
Build on top of #100440
I’ve only just started looking at these code, please point out if I miss something.
A
VMap
provides array based ordered storage for a series of key-value pairs and offers a map-like interface. Currently it is only used in VisualShader code, and only three methods are used:insert
,has
andoperator[]
. It seems the user just want a normalMap
. So I replace it withHashMap
.Performance wise
HashMap
should be faster (O(1)
) compared toVMap
(O(log(n))
) theoretically, but I barely use visual shader and have no idea how to bench this.This together with #100440 will obsolete
VMap
, shall we remove it or not?