Skip to content

perf(assetserver): skip MIME sniff reads for known extensions - #6414

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

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

Conversation

@taliesin-ai

Copy link
Copy Markdown
Collaborator

Asset file responses always read up to 512 bytes for MIME sniffing before consulting the extension table, even though known extensions determine the same MIME type regardless of content. HEAD requests therefore performed unnecessary reads, and seekable GETs read and rewound a redundant prefix.

Selected because this is directly measurable unnecessary I/O on the asset-serving path. Extract the existing case-aware extension lookup into a shared helper. The file server now reads a sniffing prefix only when the extension is unknown; GetMimetype retains the same public behavior. Unknown extensions still fill the prefix across short reads and use DetectContentType. Known extensions and explicit Content-Type headers retain their precedence. Non-seekable GETs copy the entire file through the existing copy path when no prefix was consumed.

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 db9561d into master Oct 28, 2026
1 of 2 checks passed
@leaanthony
leaanthony deleted the codex/v3-20261028-port-024 branch October 28, 2026 11:03
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