Title: Optimize sanitizer hot paths for high-throughput response conversion · Issue #3117 · github/github-mcp-server · GitHub
Open Graph Title: Optimize sanitizer hot paths for high-throughput response conversion · Issue #3117 · github/github-mcp-server
X Title: Optimize sanitizer hot paths for high-throughput response conversion · Issue #3117 · github/github-mcp-server
Description: Describe the bug Sanitization is now applied consistently across user-authored response fields, but the current pipeline performs repeated rune conversion and multiple full-string passes. At high request rates this becomes allocation- an...
Open Graph Description: Describe the bug Sanitization is now applied consistently across user-authored response fields, but the current pipeline performs repeated rune conversion and multiple full-string passes. At high r...
X Description: Describe the bug Sanitization is now applied consistently across user-authored response fields, but the current pipeline performs repeated rune conversion and multiple full-string passes. At high r...
Opengraph URL: https://github.com/github/github-mcp-server/issues/3117
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Optimize sanitizer hot paths for high-throughput response conversion","articleBody":"### Describe the bug\n\nSanitization is now applied consistently across user-authored response fields, but the current pipeline performs repeated rune conversion and multiple full-string passes. At high request rates this becomes allocation- and GC-bound on list/comment-heavy responses.\n\nMeasured examples on current main:\n- 100 comments × 1 KiB: about 3.35 ms and 2.06 MiB allocated per conversion.\n- 30 issues with 2 KiB bodies: about 2.14 ms and 1.30 MiB allocated.\n- A 64 KiB body: about 2.38 ms and 1.21 MiB allocated.\n\nAt roughly 1,250 requests/second, workloads dominated by these shapes can require several CPU cores and produce multi-gigabyte/second allocation rates.\n\n### Affected version\n\nCurrent `main` as of 2026-08-19, after the sanitizer coverage and post-normalization Unicode filtering changes.\n\n### Steps to reproduce the behavior\n\n1. Benchmark `sanitize.Sanitize` for short titles, 1 KiB comments, and 64 KiB bodies.\n2. Benchmark representative minimal-converter pages containing 30 issues or 100 comments.\n3. Compare CPU time and allocations with the pre-sanitization converter paths.\n4. Observe repeated `[]rune` conversion and post-normalization passes dominating CPU and allocations.\n\n### Expected vs actual behavior\n\nExpected: sanitization preserves the current output and security policy with negligible overhead for ordinary clean text.\n\nActual: benign content pays for repeated allocating scans and HTML-policy processing, making high-throughput response conversion GC-bound.\n\nOptimize without weakening behavior:\n- Make invisible-character filtering scan first and return the original string without allocation when no filtered rune exists.\n- Skip the post-HTML invisible/code-fence pass when normalization returned unchanged content.\n- Add only a conservative, proven-safe fast path for clean printable ASCII that cannot contain HTML/entity syntax.\n- Preserve byte-for-byte sanitizer output across a broad corpus, fuzz/property tests, and all existing edge cases.\n- Add committed benchmarks and report before/after CPU and allocation results for representative response shapes.\n\n### Logs\n\nN/A","author":{"url":"https://github.com/SamMorrowDrums","@type":"Person","name":"SamMorrowDrums"},"datePublished":"2026-08-19T13:59:49Z","url":"https://github.com/github/github-mcp-server/issues/3117"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:192c1a67-df01-baf0-baf5-37f04d5d7f3a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D378:4E4E7:1AFF5C0:23CCDA7:6B068596 |
| html-safe-nonce | 467e89d2be809b5e8337abf23c3f04bd5ef9a99f381dc16828ae448b3a82c1bd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzc4OjRFNEU3OjFBRkY1QzA6MjNDQ0RBNzo2QjA2ODU5NiIsInZpc2l0b3JfaWQiOiI0NTIzMDU2MTkwNzc0NjU0OTQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 26349b549e061f271f466734cf8759ad9a5a82ede958694442fd1211021b788b |
| hovercard-subject-tag | issue:5193467798 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github/github-mcp-server/3117/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fce5085386b2f229176460d7bafda9d93aead7810b074bfda7478e81591f73a7/github/github-mcp-server/issues/3117 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fce5085386b2f229176460d7bafda9d93aead7810b074bfda7478e81591f73a7/github/github-mcp-server/issues/3117 |
| og:image:alt | Describe the bug Sanitization is now applied consistently across user-authored response fields, but the current pipeline performs repeated rune conversion and multiple full-string passes. At high r... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | SamMorrowDrums |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4462ff7ebfd3d551f202659f2423dae617b6849d23b1df6465dc504ef497d14a |
| turbo-cache-control | no-preview |
| go-import | github.com/github/github-mcp-server git https://github.com/github/github-mcp-server.git |
| octolytics-dimension-user_id | 9919 |
| octolytics-dimension-user_login | github |
| octolytics-dimension-repository_id | 942771284 |
| octolytics-dimension-repository_nwo | github/github-mcp-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 942771284 |
| octolytics-dimension-repository_network_root_nwo | github/github-mcp-server |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 6d3909414814ff86ce7da4c51a0f4918a13fb41b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width