a2ui-project / a2ui-project/a2ui

[javascript] Optimize DataModel Notification Strategy

オープン
#842 コメント 9 件 リアクション 0 件 担当者 0 名 GitHub で見る
component: angular renderer component: lit renderer component: react renderer P3 type: feature/enhancement
主要言語
TypeScript
スター
16.4k
フォーク
1.3k
平均マージ
2日 13時間
マージ済み PR(30日)
134

説明

# Proposal: Optimize DataModel Notification Strategy

## Reason
The current `DataModel.notifySignals` implementation performs a linear scan of all registered signals to find descendants whenever a value is updated. This becomes a performance bottleneck as the number of reactive bindings grows.

## Design
1. **Trie Structure**: Replace the flat `Map` for signals with a Trie (Prefix Tree).
2. **Efficient Lookup**: When a path like `/user` is updated:
- **Bubble**: Traverse up the tree to notify ancestors.
- **Cascade**: Visit the subtree at `user` to notify all descendants.
3. **Complexity**: This reduces notification overhead from $O(N)$ (where $N$ is total signals) to $O(P + D)$ (where $P$ is path depth and $D$ is the number of actual descendants).

## Key Files
- `renderers/web_core/src/v0_9/state/data-model.ts`

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。