Skip to content

[Tree widget]: rename caches on next#1679

Merged
JonasDov merged 2 commits into
tree-widget/nextfrom
JonasD/rename-caches
May 15, 2026
Merged

[Tree widget]: rename caches on next#1679
JonasDov merged 2 commits into
tree-widget/nextfrom
JonasD/rename-caches

Conversation

@JonasDov
Copy link
Copy Markdown
Contributor

Renames from: #1678.
Renamed:

  • ModelCategoryElementsCountCache -> DescendantsCountCache
  • ElementChildrenCache -> ChildElementsCache

Copilot AI review requested due to automatic review settings May 15, 2026 08:44
@JonasDov JonasDov requested review from a team as code owners May 15, 2026 08:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 DescendantsCountCache and updated its restart token namespace.
  • Introduced ChildElementsCache and switched BaseIdsCache to 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

  • getDescendantsCounts returns a single number for one {modelId, categoryId} pair, but the plural name reads like it returns multiple counts. Consider renaming to getDescendantsCount (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:186
  • createChildElementsMapEntries always calls createChildElementsLoadingMapEntries, even when elementsToQuery is empty. That does unnecessary work and also calls getOptimalBatchSize with totalSize = 0 (which currently yields NaN). Consider skipping loading-entry creation when there’s nothing to query, or have createChildElementsLoadingMapEntries early-return a resolved promise for the empty case.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@JonasDov JonasDov merged commit 72114e0 into tree-widget/next May 15, 2026
11 checks passed
@JonasDov JonasDov deleted the JonasD/rename-caches branch May 15, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants