[Tree widget]: rename caches on next#1679
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request continues the “cache rename” effort from #1678 by updating internal tree-widget caches to the new naming (DescendantsCountCache, ChildElementsCache) and adjusting the primary cache wrapper and unit tests accordingly.
Changes:
- Renamed the elements-count cache class/methods to
DescendantsCountCacheand updated its restart token namespace. - Introduced
ChildElementsCacheand switchedBaseIdsCacheto use it. - Updated descendants count cache tests to use the new names/APIs.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
packages/itwin/tree-widget/src/tree-widget-react/components/trees/common/internal/caches/DescendantsCountCache.ts |
Renames the cache class / API and updates restart token path. |
packages/itwin/tree-widget/src/tree-widget-react/components/trees/common/internal/caches/ChildElementsCache.ts |
Adds the newly named child-elements cache implementation. |
packages/itwin/tree-widget/src/tree-widget-react/components/trees/common/internal/caches/BaseIdsCache.ts |
Swaps wrapper to the new cache names and exposes updated methods. |
packages/itwin/tree-widget/src/test/trees/common/internal/DescendantsCountCache.test.ts |
Updates unit tests for the renamed descendants-count cache API. |
Comments suppressed due to low confidence (2)
packages/itwin/tree-widget/src/tree-widget-react/components/trees/common/internal/caches/DescendantsCountCache.ts:113
getDescendantsCountsreturns a singlenumberfor one{modelId, categoryId}pair, but the plural name reads like it returns multiple counts. Consider renaming togetDescendantsCount(singular) or changing the API to actually return a collection of counts if that’s the intent.
packages/itwin/tree-widget/src/tree-widget-react/components/trees/common/internal/caches/ChildElementsCache.ts:186createChildElementsMapEntriesalways callscreateChildElementsLoadingMapEntries, even whenelementsToQueryis empty. That does unnecessary work and also callsgetOptimalBatchSizewithtotalSize = 0(which currently yieldsNaN). Consider skipping loading-entry creation when there’s nothing to query, or havecreateChildElementsLoadingMapEntriesearly-return a resolved promise for the empty case.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Tree-Widget Next benchmark
| Benchmark suite | Current: f5ea855 | Previous: 075b3d4 | Deviation | Status |
|---|---|---|---|---|
models tree 50k 3D elements search > get search paths |
1196 ms |
1281 ms |
-6.64% |
〰️ |
models tree 50k 3D elements search > get search paths (P95 of main thread blocks) |
52 ms |
64 ms |
-18.75% |
〰️ |
models tree 50k 3D elements search > load hierarchy from search paths |
112407 ms |
120795 ms |
-6.94% |
〰️ |
models tree 50k 3D elements search > load hierarchy from search paths (P95 of main thread blocks) |
37 ms |
36 ms |
2.78% |
〰️ |
models tree 50k categories > collect nodes |
2899 ms |
3120 ms |
-7.08% |
〰️ |
models tree 50k categories > collect nodes (P95 of main thread blocks) |
125 ms |
147 ms |
-14.97% |
〰️ |
models tree 50k categories > validate initial visibility |
2600 ms |
2633 ms |
-1.25% |
〰️ |
models tree 50k categories > validate initial visibility (P95 of main thread blocks) |
0 ms |
0 ms |
0% |
🟰 |
models tree 50k categories > change visibility |
76 ms |
81 ms |
-6.17% |
〰️ |
models tree 50k categories > change visibility (P95 of main thread blocks) |
65 ms |
71 ms |
-8.45% |
〰️ |
models tree 50k categories > validate changed visibility |
4863 ms |
4718 ms |
3.07% |
〰️ |
models tree 50k categories > validate changed visibility (P95 of main thread blocks) |
27 ms |
27 ms |
0% |
🟰 |
models tree 50k 3D elements > collect nodes |
45698 ms |
47809 ms |
-4.42% |
〰️ |
models tree 50k 3D elements > collect nodes (P95 of main thread blocks) |
69 ms |
61 ms |
13.11% |
〰️ |
models tree 50k 3D elements > validate initial visibility |
2503 ms |
2620 ms |
-4.47% |
〰️ |
models tree 50k 3D elements > validate initial visibility (P95 of main thread blocks) |
0 ms |
0 ms |
0% |
🟰 |
models tree 50k 3D elements > change model visibility |
21 ms |
24 ms |
-12.50% |
〰️ |
models tree 50k 3D elements > change model visibility (P95 of main thread blocks) |
0 ms |
0 ms |
0% |
🟰 |
models tree 50k 3D elements > validate changed model visibility |
2637 ms |
2600 ms |
1.42% |
〰️ |
models tree 50k 3D elements > validate changed model visibility (P95 of main thread blocks) |
27 ms |
0 ms |
2700% |
〰️ |
models tree 50k 3D elements > change category node visibility |
558 ms |
528 ms |
5.68% |
〰️ |
models tree 50k 3D elements > change category node visibility (P95 of main thread blocks) |
69 ms |
65 ms |
6.15% |
〰️ |
models tree 50k 3D elements > validate changed category visibility |
2541 ms |
2608 ms |
-2.57% |
〰️ |
models tree 50k 3D elements > validate changed category visibility (P95 of main thread blocks) |
0 ms |
0 ms |
0% |
🟰 |
models tree 50k 3D elements > validate per-model category override |
2491 ms |
2578 ms |
-3.37% |
〰️ |
models tree 50k 3D elements > validate per-model category override (P95 of main thread blocks) |
0 ms |
0 ms |
0% |
🟰 |
models tree 50k 3D elements > change element visibility |
10 ms |
11 ms |
-9.09% |
〰️ |
models tree 50k 3D elements > change element visibility (P95 of main thread blocks) |
0 ms |
0 ms |
0% |
🟰 |
models tree 50k 3D elements > validate changed element visibility |
3171 ms |
3366 ms |
-5.79% |
〰️ |
models tree 50k 3D elements > validate changed element visibility (P95 of main thread blocks) |
71 ms |
75 ms |
-5.33% |
〰️ |
models tree 50k 3D child elements with different categories > collect nodes |
45633 ms |
48007 ms |
-4.95% |
〰️ |
models tree 50k 3D child elements with different categories > collect nodes (P95 of main thread blocks) |
61 ms |
65 ms |
-6.15% |
〰️ |
models tree 50k 3D child elements with different categories > validate initial visibility |
2488 ms |
2647 ms |
-6.01% |
〰️ |
models tree 50k 3D child elements with different categories > validate initial visibility (P95 of main thread blocks) |
0 ms |
32 ms |
-100% |
〰️ |
models tree 50k 3D child elements with different categories > change visibility |
10 ms |
10 ms |
0% |
🟰 |
models tree 50k 3D child elements with different categories > change visibility (P95 of main thread blocks) |
0 ms |
0 ms |
0% |
🟰 |
models tree 50k 3D child elements with different categories > validate changed visibility |
3151 ms |
3259 ms |
-3.31% |
〰️ |
models tree 50k 3D child elements with different categories > validate changed visibility (P95 of main thread blocks) |
73 ms |
74 ms |
-1.35% |
〰️ |
categories tree 50k subCategories search > get search paths |
1822 ms |
1927 ms |
-5.45% |
〰️ |
categories tree 50k subCategories search > get search paths (P95 of main thread blocks) |
45 ms |
45 ms |
0% |
🟰 |
categories tree 50k subCategories search > load hierarchy from search paths |
5437 ms |
5688 ms |
-4.41% |
〰️ |
categories tree 50k subCategories search > load hierarchy from search paths (P95 of main thread blocks) |
45 ms |
52 ms |
-13.46% |
〰️ |
categories tree 50k subCategories > collect nodes |
5996 ms |
6134 ms |
-2.25% |
〰️ |
categories tree 50k subCategories > collect nodes (P95 of main thread blocks) |
48 ms |
48 ms |
0% |
🟰 |
categories tree 50k subCategories > validate initial visibility |
1695 ms |
1761 ms |
-3.75% |
〰️ |
categories tree 50k subCategories > validate initial visibility (P95 of main thread blocks) |
0 ms |
21 ms |
-100% |
〰️ |
categories tree 50k subCategories > change visibility |
340 ms |
354 ms |
-3.95% |
〰️ |
categories tree 50k subCategories > change visibility (P95 of main thread blocks) |
27 ms |
23 ms |
17.39% |
〰️ |
categories tree 50k subCategories > validate changed visibility |
1612 ms |
1659 ms |
-2.83% |
〰️ |
categories tree 50k subCategories > validate changed visibility (P95 of main thread blocks) |
31 ms |
28 ms |
10.71% |
〰️ |
categories tree 50k categories > collect nodes |
2500 ms |
2664 ms |
-6.16% |
〰️ |
categories tree 50k categories > collect nodes (P95 of main thread blocks) |
136 ms |
131 ms |
3.82% |
〰️ |
categories tree 50k categories > validate initial visibility |
7436 ms |
7557 ms |
-1.60% |
〰️ |
categories tree 50k categories > validate initial visibility (P95 of main thread blocks) |
88 ms |
95 ms |
-7.37% |
〰️ |
categories tree 50k categories > change visibility |
692 ms |
741 ms |
-6.61% |
〰️ |
categories tree 50k categories > change visibility (P95 of main thread blocks) |
54 ms |
61 ms |
-11.48% |
〰️ |
categories tree 50k categories > validate changed visibility |
7490 ms |
7545 ms |
-0.73% |
〰️ |
categories tree 50k categories > validate changed visibility (P95 of main thread blocks) |
41 ms |
41 ms |
0% |
🟰 |
classifications tree 50k classifications search > get search paths |
2107 ms |
2270 ms |
-7.18% |
〰️ |
classifications tree 50k classifications search > get search paths (P95 of main thread blocks) |
146 ms |
141 ms |
3.55% |
〰️ |
classifications tree 50k classifications search > load hierarchy from search paths |
70698 ms |
71660 ms |
-1.34% |
〰️ |
classifications tree 50k classifications search > load hierarchy from search paths (P95 of main thread blocks) |
0 ms |
25 ms |
-100% |
〰️ |
classifications tree 50k classifications > collect nodes |
40749 ms |
38416 ms |
6.07% |
〰️ |
classifications tree 50k classifications > collect nodes (P95 of main thread blocks) |
86 ms |
91 ms |
-5.49% |
〰️ |
classifications tree 50k classifications > validate initial visibility |
5102 ms |
4927 ms |
3.55% |
〰️ |
classifications tree 50k classifications > validate initial visibility (P95 of main thread blocks) |
56 ms |
59 ms |
-5.08% |
〰️ |
classifications tree 50k classifications > change visibility |
27 ms |
30 ms |
-10% |
〰️ |
classifications tree 50k classifications > change visibility (P95 of main thread blocks) |
0 ms |
0 ms |
0% |
🟰 |
classifications tree 50k classifications > validate changed visibility |
5066 ms |
5207 ms |
-2.71% |
〰️ |
classifications tree 50k classifications > validate changed visibility (P95 of main thread blocks) |
80 ms |
73 ms |
9.59% |
〰️ |
This comment was automatically generated by workflow using github-action-benchmark.
grigasp
approved these changes
May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Renames from: #1678.
Renamed:
ModelCategoryElementsCountCache->DescendantsCountCacheElementChildrenCache->ChildElementsCache