improvement(tree): Maintain column/row ID -> node cache for faster lookup#27236
Conversation
|
Hi! Thank you for opening this PR. Want me to review it? Based on the diff (270 lines, 2 files), I've queued these reviewers:
How this works
|
There was a problem hiding this comment.
Pull request overview
This PR optimizes TableSchema row/column lookups by replacing repeated linear scans with lazily built ID→node caches inside the table implementation. It fits into the tree table API as a performance improvement for getCell, setCell, and other APIs that resolve rows/columns by string ID.
Changes:
- Add lazy row and column ID lookup caches to
TableSchema.Table. - Invalidate those caches from
nodeChangedlisteners on the row/column arrays. - Route
#tryGetRowand#tryGetColumnstring-ID lookups through the caches instead ofArray.find.
This was identified as a key bottleneck in some consumer scenarios. Caching the ID -> node mapping saves an O(n) lookup for each operation.