Skip to content

Reuse fresh parser resources before speculative host loads #379

Description

@wieslawsoltes

Parent: #266. Related epics: #264, #227.

Proven gap

On exact WebScene main a759ff3a008e362708b6b281ebb7c2742921eb53, normal text-resource loading derives its persistent/process cache key from resource kind, resolved URL, initiator origin, and cookie representation. Parser speculative prefetch instead looks up the same cache using only resource kind and resolved URL.

That key mismatch bypasses an already-fresh admitted script or stylesheet before normal loading can consume it. The current native regression consequently performs duplicate host reads across engine generations (document and script bodies were not reused from the process resource cache and the related four-engine single-flight request-count failure). This directly affects repeated Markdown/webview parser resources after the Service Worker cache-continuity work in #376/#378.

Scope

  • Derive speculative-prefetch cache lookups from the same origin/cookie-partitioned representation key as normal loading.
  • Reuse only entries that are already fresh under the existing expiry metadata. Preserve existing validator revalidation and stale-fallback behavior for non-fresh entries.
  • Keep resource kind, resolved URL, initiator origin, cookie, credentials, admission, and host callback boundaries unchanged and fail closed.
  • Add a browser/WPT-derived freshness oracle plus native exact-key, validator, duplicate-read, 100-cycle latency/memory, and teardown gates.

Exclusions

No new filesystem or network authority; no CacheStorage durability or cross-origin sharing; no change to Service Worker registration, localResourceRoots, localhost mapping, CSP, AppScene, File System Access #248, consolidation #76, or vscode-demo.

Acceptance

  • A fresh parser script/stylesheet cached under one origin/cookie representation is reused without another host read.
  • A different origin or cookie representation never consumes that entry.
  • Expired entries still carry validators to the host and consume a 304 result through the existing path.
  • Browser and native results agree on fresh reuse versus validator revalidation.
  • 100 repeated create/load/destroy cycles stay within p95 <= 100 ms for the cached resource step, <= 8 MiB retained V8 heap after warm-up, and <= 64 MiB RSS after teardown.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    vscode-oss/plannedPlanned for the AppScene/WebScene VS Code OSS integration

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions