[GH-ISSUE #7702] Advanced Memory: prepare() spends ~4.7 s per reply at 800 scenes rebuilding message maps #4253

Closed
opened 2026-10-21 06:13:33 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @SpicyMarinara on GitHub (Oct 15, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7702

Originally assigned to: @SpicyMarinara on GitHub.

Found while measuring #7701 (offline harness, synthetic chats):

  • The cost: in a long Roleplay chat with Advanced Memory, prepare() takes about 4.7–4.9 s before every reply at 800 closed scenes (about 0.3 s at 200).
  • The cause: about 90% of it is recordValid rebuilding message maps for every stored record on every prepare.
  • When it happens: with or without the Decision model, and on staging before #7701 too.
  • Wanted: build the message lookup once per prepare (or cache it per chat revision), so the time before the first token doesn't grow with the size of the archive.

Related: #7699, #7701.

Originally created by @SpicyMarinara on GitHub (Oct 15, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7702 Originally assigned to: @SpicyMarinara on GitHub. Found while measuring #7701 (offline harness, synthetic chats): - **The cost:** in a long Roleplay chat with Advanced Memory, `prepare()` takes about **4.7–4.9 s before every reply at 800 closed scenes** (about 0.3 s at 200). - **The cause:** about 90% of it is `recordValid` rebuilding message maps for every stored record on every prepare. - **When it happens:** with or without the Decision model, and on staging before #7701 too. - **Wanted:** build the message lookup once per prepare (or cache it per chat revision), so the time before the first token doesn't grow with the size of the archive. Related: #7699, #7701.
bsakaguchi 2026-10-21 06:13:33 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Oct 16, 2026):

Working on this in #7730.

<!-- gh-comment-id:6212418404 --> @SpicyMarinara commented on GitHub (Oct 16, 2026): Working on this in #7730.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4253
No description provided.