Skip to content

Reduce ExtractWorkflowNameFromFile overhead in the title-scan path#31598

Merged
pelikhan merged 5 commits into
mainfrom
copilot/fix-performance-regression-extract-workflow-name
May 12, 2026
Merged

Reduce ExtractWorkflowNameFromFile overhead in the title-scan path#31598
pelikhan merged 5 commits into
mainfrom
copilot/fix-performance-regression-extract-workflow-name

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 11, 2026

  • Inspect prior comments and affected files
  • Run existing targeted tests to establish baseline
  • Make minimal fixes for actionable review feedback
  • Re-run targeted validation and secret scan
  • Reply to the new PR comment with the addressing commit hash
  • Run final validation checks

Copilot AI changed the title [WIP] Fix performance regression in ExtractWorkflowNameFromFile Reduce ExtractWorkflowNameFromFile overhead in the title-scan path May 11, 2026
Copilot AI requested a review from gh-aw-bot May 11, 2026 23:14
@pelikhan pelikhan marked this pull request as ready for review May 11, 2026 23:17
Copilot AI review requested due to automatic review settings May 11, 2026 23:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 for fastParseTitleFromReader (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

Comment thread pkg/cli/workflows.go Outdated

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"

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot review all comments

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 12, 2026

@copilot review all comments

Addressed in 6546c02.

Copilot AI requested a review from pelikhan May 12, 2026 01:22
@pelikhan pelikhan merged commit 8d3591d into main May 12, 2026
@pelikhan pelikhan deleted the copilot/fix-performance-regression-extract-workflow-name branch May 12, 2026 01:41
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.

[performance] Regression in ExtractWorkflowNameFromFile: +21.0% slower

4 participants