Skip to content

perf: speed up shot parsing with early tag filtering - #16

Merged
qartik merged 1 commit into
mainfrom
copilot/perf-speed-up-shot-parsing
Aug 17, 2026
Merged

qartik merged 1 commit into
mainfrom
copilot/perf-speed-up-shot-parsing

Conversation

@qartik

@qartik qartik commented Aug 12, 2026

Copy link
Copy Markdown
Member

Description

Optimized emit_values_in_shot() to skip non-USER tags efficiently using early filtering and idiomatic string operations.

Changes

  • Use startswith() prefix check to quickly skip non-USER tags without string splitting
  • Replace split() with partition() for parsing USER tags (more efficient)
  • Avoid list creation and bounds checking for filtered-out tags

This improves performance when processing shots with many non-USER tags (MEAS, METRICS, EXIT), as only USER-tagged items now undergo string parsing.

Testing

All 33 existing tests pass, covering:

  • Standard formatting for all supported types
  • Malformed data handling
  • Complete shot sequences with mixed tag types
  • Edge cases and empty tags

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Optimizes USER-tag parsing while preserving existing formatting behavior.

Changes:

  • Filters non-USER tags before parsing.
  • Uses partition() to parse type and tag without list allocation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@qartik
qartik requested review from chesterwringe and pschow August 12, 2026 15:18
@qartik
qartik merged commit 9d29324 into main Aug 17, 2026
3 checks passed
@qartik
qartik deleted the copilot/perf-speed-up-shot-parsing branch August 17, 2026 12:45
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.

3 participants