René's URL Explorer Experiment


Title: perf(coderd/database/db2sdk): avoid constructing a full git provider per chat row · Issue #28142 · coder/coder · GitHub

Open Graph Title: perf(coderd/database/db2sdk): avoid constructing a full git provider per chat row · Issue #28142 · coder/coder

X Title: perf(coderd/database/db2sdk): avoid constructing a full git provider per chat row · Issue #28142 · coder/coder

Description: Follow-up from #27711 (CRF-16). Problem coderd/database/db2sdk/db2sdk.go constructs a full GitHub provider per converted chat row to run two pure string functions (ParseRepositoryOrigin and BuildBranchURL). Measured by four independent r...

Open Graph Description: Follow-up from #27711 (CRF-16). Problem coderd/database/db2sdk/db2sdk.go constructs a full GitHub provider per converted chat row to run two pure string functions (ParseRepositoryOrigin and BuildBr...

X Description: Follow-up from #27711 (CRF-16). Problem coderd/database/db2sdk/db2sdk.go constructs a full GitHub provider per converted chat row to run two pure string functions (ParseRepositoryOrigin and BuildBr...

Opengraph URL: https://github.com/coder/coder/issues/28142

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"perf(coderd/database/db2sdk): avoid constructing a full git provider per chat row","articleBody":"Follow-up from #27711 (CRF-16).\n\n## Problem\n\n`coderd/database/db2sdk/db2sdk.go` constructs a full GitHub provider per converted chat row to run two pure string functions (`ParseRepositoryOrigin` and `BuildBranchURL`).\n\nMeasured by four independent reviewers in round 1 of #27711:\n\n- Construction cost: **~46-73 us, ~46 KB, 451 allocations** per call, dominated by three `regexp.MustCompile` calls in `newGitHub` plus a fresh 2048-slot cache map.\n- The two string functions actually needed cost **~1.1 us and 195 B**. So **97% of the work is thrown away**.\n- The construction runs per row via `Chat`, `ChildChatRows` and `ChatRowsWithChildren` (10 call sites), reached from the chat list endpoint. A 100-row list response with branch-but-no-PR rows pays roughly **5 to 7 ms and 4.6 MB of garbage**.\n\nCorrectness is unaffected: this path only parses and formats URLs, so no ETag state is lost. The code in question:\n\n```go\n// coderd/database/db2sdk/db2sdk.go, inside the chat diff status converter\n// TODO: This uses the default github.com API base URL,\n// so branch URLs for GitHub Enterprise instances will\n// be incorrect.\ngp, _ := gitprovider.New(\"github\", \"\", nil)\nif gp != nil {\n\tif owner, repo, _, ok := gp.ParseRepositoryOrigin(status.GitRemoteOrigin); ok {\n\t\tbranchURL := gp.BuildBranchURL(owner, repo, status.GitBranch)\n\t\t...\n\t}\n}\n```\n\n## Two fix shapes\n\n1. **Cheap: package-level `sync.OnceValue`** for the default github.com provider.\n   - About 5 lines. Kills 97% of the waste for the github.com case, which is the only host this code ever targets today (`gitprovider.New(\"github\", \"\", nil)` hardcodes the default base URL).\n   - Does not fix the GHE case, but that case is already broken today per the existing TODO.\n\n2. **Proper: move URL parsing and building into package-level functions** with package-level regexps, and have the provider methods delegate.\n   - About 40 lines, but touches the `Provider` interface (all implementations).\n   - Removes the incentive to construct a provider for string work, not just the cost.\n   - Also fixes the existing TODO (GitHub Enterprise hosts get wrong branch URLs) if the functions take the host as a parameter.\n\nThe existing `TODO` above the call already records the correctness half of the same design gap.\n\n## Context from #27711\n\nThis is the last live instance of the exact class that PR fixed one layer up: per-call provider construction throwing away work and state. Seven reviewers found it independently in round 1, all rated it P4, four with benchmarks that agreed. It predates #27711 and carries no cache state, which is why it stayed out of that PR.\n\n> 🤖 Generated by Coder Agents on behalf of @johnstcn.","author":{"url":"https://github.com/johnstcn","@type":"Person","name":"johnstcn"},"datePublished":"2026-08-13T17:37:01Z","url":"https://github.com/coder/coder/issues/28142"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:88a27a1a-7beb-db10-8b98-8245fb3d0a8d
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB54A:32A711:620975:8707AB:6B04A4FC
html-safe-nonce2f2e1c903b51213bb5391be7f7dc980d0701acfa3bb9d4221da910f3acb92053
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNTRBOjMyQTcxMTo2MjA5NzU6ODcwN0FCOjZCMDRBNEZDIiwidmlzaXRvcl9pZCI6IjM4NzgwMTA5OTIyMzE0OTA4MTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacd08c1379e784c6de5a23060c4e656dd7d802e986289a67c6dd15e4a39cde935a
hovercard-subject-tagissue:5144128986
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/coder/28142/issue_layout
twitter:imagehttps://opengraph.githubassets.com/8d0ff37f150b089a6b1bcdad852c1768053857b968a1f8a5fdeee27370f119d1/coder/coder/issues/28142
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/8d0ff37f150b089a6b1bcdad852c1768053857b968a1f8a5fdeee27370f119d1/coder/coder/issues/28142
og:image:altFollow-up from #27711 (CRF-16). Problem coderd/database/db2sdk/db2sdk.go constructs a full GitHub provider per converted chat row to run two pure string functions (ParseRepositoryOrigin and BuildBr...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejohnstcn
hostnamegithub.com
expected-hostnamegithub.com
None188497a0f45a7aa8f7c866faa1950d1a7f8d82b59416adf549b222ad1d1dd19b
turbo-cache-controlno-preview
go-importgithub.com/coder/coder git https://github.com/coder/coder.git
octolytics-dimension-user_id95932066
octolytics-dimension-user_logincoder
octolytics-dimension-repository_id440752086
octolytics-dimension-repository_nwocoder/coder
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id440752086
octolytics-dimension-repository_network_root_nwocoder/coder
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release557cfbac6cdb532730c95c90f2cefdc0c4128029
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/coder/coder/issues/28142#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcoder%2Fcoder%2Fissues%2F28142
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcoder%2Fcoder%2Fissues%2F28142
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=coder%2Fcoder
Reloadhttps://github.com/coder/coder/issues/28142
Reloadhttps://github.com/coder/coder/issues/28142
Reloadhttps://github.com/coder/coder/issues/28142
coderhttps://github.com/coder
coderhttps://github.com/coder/coder
Codehttps://github.com/coder/coder
Issues322 (322)https://github.com/coder/coder/issues
Pull requests477 (477)https://github.com/coder/coder/pulls
Discussionshttps://github.com/coder/coder/discussions
Actionshttps://github.com/coder/coder/actions
Projectshttps://github.com/coder/coder/projects
Security and quality49 (49)https://github.com/coder/coder/security
Insightshttps://github.com/coder/coder/insights
https://github.com/coder/coder
New issuehttps://github.com/login?return_to=https://github.com/coder/coder/issues/28142
New issuehttps://github.com/login?return_to=https://github.com/coder/coder/issues/28142
perf(coderd/database/db2sdk): avoid constructing a full git provider per chat rowhttps://github.com/coder/coder/issues/28142#top
performancehttps://github.com/coder/coder/issues?q=state%3Aopen%20label%3A%22performance%22
https://github.com/johnstcn
johnstcnhttps://github.com/johnstcn
on Aug 13, 2026https://github.com/coder/coder/issues/28142#issue-5144128986
#27711https://github.com/coder/coder/pull/27711
#27711https://github.com/coder/coder/pull/27711
#27711https://github.com/coder/coder/pull/27711
#27711https://github.com/coder/coder/pull/27711
@johnstcnhttps://github.com/johnstcn
johnstcnhttps://github.com/johnstcn
performancehttps://github.com/coder/coder/issues?q=state%3Aopen%20label%3A%22performance%22
on Aug 13, 2026https://github.com/coder/coder/issues/28142#event-29415252529
https://github.com/apps/linear-code
linear-codehttps://github.com/apps/linear-code
on Aug 13, 2026https://github.com/coder/coder/issues/28142#issuecomment-5284226523
Linear Codehttps://linear.app
ENG-3172https://linear.app/codercom/issue/ENG-3172
johnstcnhttps://github.com/johnstcn
on Aug 18, 2026https://github.com/coder/coder/issues/28142#event-29605409512
fix: follow-up fixes for conditional VCS requests (#27711)https://github.com/coder/coder/commit/6079c514ee991a4d89bf770ab91ff81b90a2127c
#27711https://github.com/coder/coder/pull/27711
6079c51https://github.com/coder/coder/commit/6079c514ee991a4d89bf770ab91ff81b90a2127c
Sign up for freehttps://github.com/signup?return_to=https://github.com/coder/coder/issues/28142
Sign in to commenthttps://github.com/login?return_to=https://github.com/coder/coder/issues/28142
performancehttps://github.com/coder/coder/issues?q=state%3Aopen%20label%3A%22performance%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.