perf(ui): widen markdown session cache
Retain detached Markdown DOM for eight recent sessions so medium-frequency session switching can restore more first-screen content without reparsing it. Limit each session to four cached parts, reducing the worst-case retained fragment count from 36 to 32 while preventing long sessions from dominating the cache.
This commit is contained in:
@@ -27,10 +27,10 @@ type DetachedMarkdownDomCacheLimits = {
|
|||||||
type SessionCache = Map<string, DetachedMarkdownDom>;
|
type SessionCache = Map<string, DetachedMarkdownDom>;
|
||||||
|
|
||||||
const DEFAULT_LIMITS: DetachedMarkdownDomCacheLimits = {
|
const DEFAULT_LIMITS: DetachedMarkdownDomCacheLimits = {
|
||||||
// Three buckets cover the common A/B/C recent-session rotation without
|
// Eight buckets cover a broader recent-session working set without
|
||||||
// coupling eviction to React commit or microtask timing.
|
// coupling eviction to React commit or microtask timing.
|
||||||
maxSessions: 3,
|
maxSessions: 8,
|
||||||
maxEntriesPerSession: 12,
|
maxEntriesPerSession: 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
export class DetachedMarkdownDomCache {
|
export class DetachedMarkdownDomCache {
|
||||||
|
|||||||
Reference in New Issue
Block a user