Skip to content

perf(webview): avoid allocating discarded request contexts - #6419

Merged
leaanthony merged 1 commit into
masterfrom
codex/v3-20261028-port-029
Oct 28, 2026
Merged

leaanthony merged 1 commit into
masterfrom
codex/v3-20261028-port-029

Conversation

@taliesin-ai

Copy link
Copy Markdown
Collaborator

RequestTracker.Wrap always allocated a child context under the tracker, then immediately cancelled and discarded it for registered requests: normal requests reuse entry.ctx, while keepalive requests need a different child under entry.ctx. The discarded context added allocations and parent-registration work inside the tracker mutex.

Selected after measuring the redundant work in normal, keepalive, and unmarked lifecycle fixtures. Allocate the tracker child only in the unmatched/unmarked branch. Registered normal requests retain their existing entry context; keepalive requests still receive an independent child of the entry context. Invalid nonempty markers still get an immediately cancelled context.

Part of the dependency-ordered Wails v3 bug/performance port series. Feature changes are excluded.

Validation: the original changes have regression coverage and local validation recorded during implementation. This port was checked for patch conflicts and whitespace errors. Per the maintainer’s instruction, package tests are not being repeated for each port and individual CI runs are not merge gates for this series. The final PR will remain open for combined CI review. Historical benchmarks have not been rerun on this port.

No release, milestone or repository-protection changes are included.

@leaanthony
leaanthony merged commit 0ebba91 into master Oct 28, 2026
4 checks passed
@leaanthony
leaanthony deleted the codex/v3-20261028-port-029 branch October 28, 2026 11:04
leaanthony pushed a commit that referenced this pull request Oct 28, 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.

2 participants