# perf: make streaming projection and activity appends incremental \(\#9152\) · gitcafe/t3code

[View on GitCafe](https://git.cafe/gitcafe/t3code/commit/c2283ce14628127ef1758974ddab4f5b1f89d47a)

Repository: [gitcafe/t3code](https://git.cafe/gitcafe/t3code)

Visibility: public

Requested revision: c2283ce14628127ef1758974ddab4f5b1f89d47a

Requested commit: c2283ce14628127ef1758974ddab4f5b1f89d47a

Commit: c2283ce14628127ef1758974ddab4f5b1f89d47a

Tree: a875787f661606d6f973b866bff89423f0ff872e

Author: Theo Browne

Committer: GitHub

## Message

```
perf: make streaming projection and activity appends incremental (#9152)

Takes over #6608 by @x1xhlol.

Server: thread.message-sent updates the projection row directly and folds latestUserMessageAt in as a running maximum instead of running refreshThreadShellSummary. Client: thread.activity-appended takes an O(1) append path for in-order, unseen activities on reducer-produced arrays, with a WeakMap id index, and falls back to filter and sort for out-of-order, re-delivered, context-window, and snapshot-loaded cases.

Reducer benchmark: 10,000 in-order appends went from 1,180 ms to 70 ms.

Change authored by Claude Fable 5.1 running in Claude Code, based on work by @x1xhlol.

Co-authored-by: Lucas Valbuena <lucknitelol@proton.me>
```

## Parents

- [feb3ea7ebf83de2e301adb1f20300b262773ec54](https://git.cafe/gitcafe/t3code/commit/feb3ea7ebf83de2e301adb1f20300b262773ec54?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/t3code/tree/c2283ce14628127ef1758974ddab4f5b1f89d47a?format=markdown)
