Reduce ExtractWorkflowNameFromFile overhead in the title-scan path#31598
Merged
pelikhan merged 5 commits intoMay 12, 2026
Merged
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/cd84e045-9c55-4e51-9faf-df01c37a628a Co-authored-by: gh-aw-bot <[email protected]>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/cd84e045-9c55-4e51-9faf-df01c37a628a Co-authored-by: gh-aw-bot <[email protected]>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/cd84e045-9c55-4e51-9faf-df01c37a628a Co-authored-by: gh-aw-bot <[email protected]>
Copilot
AI
changed the title
[WIP] Fix performance regression in ExtractWorkflowNameFromFile
Reduce May 11, 2026
ExtractWorkflowNameFromFile overhead in the title-scan path
Contributor
There was a problem hiding this comment.
Pull request overview
Reduces allocation overhead in the hot path used to extract workflow titles from file content by reusing the initial bufio.Scanner buffer, while preserving behavior for large frontmatter lines.
Changes:
- Introduces a small
sync.Pool-backed reusable scanner buffer forfastParseTitleFromReader(keeping the 1 MB max token size). - Adds a regression test ensuring H1 extraction still works when frontmatter contains a line larger than the default scanner token size.
- Minor gofmt-driven alignment update in a frontmatter extraction test case.
Show a summary per file
| File | Description |
|---|---|
| pkg/cli/workflows.go | Adds pooled scanner buffer reuse in fastParseTitleFromReader to reduce per-call allocations. |
| pkg/cli/commands_utils_test.go | Adds regression coverage for title extraction with oversized frontmatter lines. |
| pkg/parser/frontmatter_extraction_test.go | Formatting/alignment update in an existing test table entry. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/3 changed files
- Comments generated: 2
|
|
||
| var workflowTitleScannerBufferPool = sync.Pool{ | ||
| New: func() any { | ||
| return make([]byte, 4*1024) |
Comment on lines
+118
to
+120
| filePath := filepath.Join(tmpDir, "large-frontmatter.md") | ||
| content := "---\nblob: " + strings.Repeat("x", 70*1024) + "\n---\n\n# Large Frontmatter Workflow\n" | ||
|
|
Collaborator
|
@copilot review all comments |
Co-authored-by: pelikhan <[email protected]>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.