Skip to content

perf(zero-cache): add head-indexed queue helpers - #8

Closed
Karavil wants to merge 1 commit into
capy/rm-vs-load-fanout-flowfrom
capy/rm-vs-load-hot-queue-helpers
Closed

perf(zero-cache): add head-indexed queue helpers#8
Karavil wants to merge 1 commit into
capy/rm-vs-load-fanout-flowfrom
capy/rm-vs-load-hot-queue-helpers

Conversation

@Karavil

@Karavil Karavil commented May 26, 2026

Copy link
Copy Markdown
Owner

what changed

Adds HeadIndexedQueue helpers and moves subscription queue internals away from array shifting on hot paths.

benchmark output

medium-wide-batch-pressure, 15s:

fanout-flow branch: 1,708.7 tx/s, 34,173.3 rows/s
hot-queue branch: 1,652.3 tx/s, 33,046.2 rows/s

This one is not a clean standalone E2E win in the single-consumer run. I kept it isolated because the helper is used by the following websocket batch PR, but it is reasonable to fold this into that PR if the team does not want a preparatory helper PR.

validation

pnpm exec vitest --project='*no-pg*' run src/types/subscription.test.ts
pnpm exec vitest --project shared/node run src/head-indexed-queue.test.ts
pnpm run check-types
pnpm --filter shared run check-types

Why: remove array shifting from hot subscription queues without replacing Greg's Queue and RingBuffer

* add HeadIndexedQueue for richer peek and replace queue operations

* use it inside Subscription's pending consumer/message queues

* cover queue helper and Subscription cleanup behavior
@Karavil
Karavil force-pushed the capy/rm-vs-load-fanout-flow branch from d68c8d6 to 4e5e06e Compare May 26, 2026 19:02
@Karavil
Karavil force-pushed the capy/rm-vs-load-hot-queue-helpers branch from 9ce0365 to 136cd4d Compare May 26, 2026 19:02
@Karavil

Karavil commented May 26, 2026

Copy link
Copy Markdown
Owner Author

Replaced by rocicorp/mono PRs rocicorp#6070 through rocicorp#6078.

@Karavil Karavil closed this May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant