-
Notifications
You must be signed in to change notification settings - Fork 219
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
Extremely slow to set individual colors to many elements in EmphasizeElements API #7888
Comments
would anyone like me to give a cloneable repro, or is it easier for you to just copy and paste the 10 relevant lines from my above code into display-test-app? If it'll help you if I make a fork with a repro in display-test-app I could get that all setup, just ask. |
Ok I think I see the issue. I will probably just patch it on my side with my package manager, and share the patch here for anyone else. |
I didn't even use package manager patching, sorry I'm not really being fastidious here. In my case I can do much simpler: emph["_overrideAppearance"] = new Map<string, string>();
for (const [id, attr] of meshData.attr) {
const hue = (attr / maxForAttr) * 360; // TODO: fix gradient to be green->red, not rainbow
const color = ColorDef.fromHSV(new HSVColor(hue, 100, 100));
const ovrKey = emph["createOverrideKey"](color, FeatureOverrideType.ColorOnly);
let overridden = emph["_overrideAppearance"].get(ovrKey);
if (overridden === undefined) {
overridden = new Set();
emph["_overrideAppearance"].set(ovrKey, overridden);
}
overridden.add(id);
}
vp.setFeatureOverrideProviderChanged(); You could probably add like an |
Describe the bug
Extremely slow to set individual colors to many elements in EmphasizeElements API,
on my machine 30,000 elements took 18 seconds.
To Reproduce
Steps to reproduce the behavior:
ViewportOnlyApp.tsx
with:Expected behavior
Setting basic element color is a fast operation, probably over every element in the scene, especially if you have precomputed the colors before setting it.
Screenshots

Profile (didn't capture the query phase it seems, and the stack traces look useless so YMMVCTSLPU)
Desktop (please complete the applicable information):
Additional context
profile in chromium: 30000_elem_coloring_profile.zip
Let me know if you want a smaller set profiled or if I can provide anything else.
adapted this issue from this discussion: #7887
The text was updated successfully, but these errors were encountered: