perf: fast-path length check in StatusHistory comparison (#22103)
Add O(1) array length check before expensive JSON.stringify comparison. During streaming, status history typically only grows via appends, so a length mismatch catches most updates without serialization.
This commit is contained in:
@@ -21,7 +21,8 @@
|
||||
status = history.at(-1);
|
||||
}
|
||||
|
||||
$: if (JSON.stringify(statusHistory) !== JSON.stringify(history)) {
|
||||
$: if (statusHistory.length !== history.length
|
||||
|| JSON.stringify(statusHistory) !== JSON.stringify(history)) {
|
||||
history = statusHistory;
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user