Reduce ParseWorkflow regression by optimizing frontmatter delimiter parsing#31583
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Optimizes the ParseWorkflow hot path by reducing work in frontmatter delimiter detection and avoiding repeated []byte→string conversions, while adding a regression-focused test for whitespace/CRLF delimiter handling.
Changes:
- Added a fast-path
isFrontmatterDelimiterLinehelper to reduce overhead in frontmatter delimiter checks. - Reused a single
contentStringin the compiler’s frontmatter parsing flow to avoid repeated conversions. - Added a focused extraction test for delimiters with surrounding whitespace and CRLF line endings.
- Updated action pin metadata and regenerated a locked workflow file.
Show a summary per file
| File | Description |
|---|---|
pkg/parser/frontmatter_content.go |
Replaces TrimSpace(...) == "---" delimiter checks with an optimized helper plus Unicode-safe fallback. |
pkg/workflow/compiler_orchestrator_frontmatter.go |
Converts workflow file bytes to a string once and reuses it across parsing/error/reporting paths. |
pkg/parser/frontmatter_extraction_test.go |
Adds coverage for whitespace-tolerant frontmatter delimiters and CRLF input. |
pkg/workflow/data/action_pins.json |
Adds a new pinned action entry for github/gh-aw-actions/setup@v0.71.5. |
pkg/actionpins/data/action_pins.json |
Mirrors the same new pinned action entry for setup. |
.github/workflows/issue-arborist.lock.yml |
Regenerates lock content and updates Codex invocation argument formatting. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 6/6 changed files
- Comments generated: 2
| "github/gh-aw-actions/setup@v0.71.5": { | ||
| "repo": "github/gh-aw-actions/setup", | ||
| "version": "v0.71.5", | ||
| "sha": "b8068426813005612b960b5ab0b8bd2c27142323" | ||
| }, |
| "github/gh-aw-actions/setup@v0.71.5": { | ||
| "repo": "github/gh-aw-actions/setup", | ||
| "version": "v0.71.5", | ||
| "sha": "b8068426813005612b960b5ab0b8bd2c27142323" | ||
| }, |
|
@copilot merge main, review all comments, recompile |
…kflow-performance # Conflicts: # .github/workflows/issue-arborist.lock.yml Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/355f4283-dea2-411d-a18d-579513ada771 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/355f4283-dea2-411d-a18d-579513ada771 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Merged Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
Agent-Logs-Url: REDACTED 1/x64/bin/node ignore` (http block)
|
✨ Enhancement
ParseWorkflowregressed by ~20.6% versus historical baseline (309µs vs 256µs). This change focuses on the frontmatter parsing hot path where delimiter detection and content string handling introduced avoidable overhead.What does this improve?
ParseWorkflowby reducing work in frontmatter delimiter checks and repeated byte→string conversions.Why is this valuable?
ParseWorkflowis on the critical path for compilation; small per-parse overhead compounds across workflows and CI runs.Implementation approach:
isFrontmatterDelimiterLine(line string)inpkg/parser/frontmatter_content.go.strings.TrimSpace(...) == "---"calls in delimiter detection with a fast-path implementation (exact match + ASCII whitespace trim) and Unicode-safe fallback.pkg/workflow/compiler_orchestrator_frontmatter.go, convert file content to string once (contentString) and reuse across parsing, error formatting, and schedule preprocessing.pkg/parser/frontmatter_extraction_test.gofor delimiters with surrounding whitespace and CRLF.