Skip to content

perf(template-outlet): Improved performance#16857

Merged
rkaraivanov merged 6 commits intomasterfrom
rkaraivanov/template-outlet-performance
Feb 5, 2026
Merged

perf(template-outlet): Improved performance#16857
rkaraivanov merged 6 commits intomasterfrom
rkaraivanov/template-outlet-performance

Conversation

@rkaraivanov
Copy link
Member

@rkaraivanov rkaraivanov commented Feb 3, 2026

  • Eliminated duplicate cache lookups: _getActionType() now returns both actionType and cachedView, avoiding redundant Map queries in _useCachedView()
  • Cached indexOf() results in _moveView(): Store indices instead of calling indexOf() twice for the same view references
  • Optimized _recreateView(): Reuse and update existing Map collections instead of creating new Map instances that overwrite existing entries
  • Faster context operations: Use Object.assign() for context updates and spread operator for cloning instead of manual iteration
  • Improved _hasContextShapeChanged(): Use Set.difference() with size check fast-path for O(1) lookups instead of O(n) indexOf()

Checklist:

  • All relevant tags have been applied to this PR

- **Eliminated duplicate cache lookups**: _getActionType() now returns both actionType
  and cachedView, avoiding redundant Map queries in _useCachedView()
- **Cached indexOf() results in _moveView()**: Store indices instead of calling indexOf()
  twice for the same view references
- **Optimized _recreateView()**: Reuse and update existing Map collections instead of
  creating new Map instances that overwrite existing entries
- **Direct detach in _useCachedView()**: Use detach(0) directly since directive always
  inserts at index 0, avoiding unnecessary indexOf() call
- **Faster context operations**: Use Object.assign() for context updates and spread
  operator for cloning instead of manual iteration
- **Improved _hasContextShapeChanged()**: Use Set.difference() with size check fast-path
  for O(1) lookups instead of O(n) indexOf()
MayaKirova
MayaKirova previously approved these changes Feb 4, 2026
@rkaraivanov rkaraivanov merged commit c367c2c into master Feb 5, 2026
6 checks passed
@rkaraivanov rkaraivanov deleted the rkaraivanov/template-outlet-performance branch February 5, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants