-
Notifications
You must be signed in to change notification settings - Fork 234
Open
Labels
Description
Describe the bug
Updating from 5.0.0 to 5.5.0 we noticed performance degradation of Viewport.changeCategoryDisplay method. It looks like it's coming from #8646 and is present since 5.2.3 version.
To Reproduce
Steps to reproduce the behavior:
- Checkout branch https://github.com/iTwin/itwinjs-core/tree/change-category-display-perf-test
- Build and run sample core full-stack-test (npm run test:chrome)
it.only("changeCategoryDisplay", async () => { changeCategoryDisplaycall with 50k categories takes about 1min.- Comment out
updateSubCategoriescall inonViewedCategoriesChangeditwinjs-core/core/frontend/src/Viewport.ts
Line 1215 in d7031a3
this.updateSubCategories(view.categorySelector.categories, undefined); - Rebuild and run test again.
changeCategoryDisplaycall with 50k categories is almost instantaneous.
Expected behavior
changeCategoryDisplay should not take about 1 min to add categories to selector.
Additional context
Looking more into this it looks like updateSubCategories does not take much time but changeCategoryDisplay adds categories one by one to selector and onViewedCategoriesChanged is raised after each addition which results in 50k calls.
Reactions are currently unavailable