Skip to content

perf(state): skip base64 forks for empty subshell-context fields#768

Merged
Chemaclass merged 1 commit into
mainfrom
perf/762-base64-empty-fork
Jul 11, 2026
Merged

perf(state): skip base64 forks for empty subshell-context fields#768
Chemaclass merged 1 commit into
mainfrom
perf/762-base64-empty-fork

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

Related #762

Every test base64-encoded its title, hook message and output when exporting subshell context, forking base64 three times even though a passing test leaves all three empty.

💡 Changes

  • Extract encode_field, which returns an empty field for empty input with no fork; base64 of "" is "", so the wire format is byte-identical. Also short-circuit decode_base64 on empty input.
  • Fork census on a 100-test file: base64 101 -> 1 (three encodes + the output decode removed per test). Platform-independent win.
  • Behaviour preserved: existing export_subshell_context characterization tests (empty and non-empty fields) plus new round-trip tests (empty, plain, multiline, ANSI) pass; full suite green sequential and --parallel.

Extract encode_field, which returns an empty field for empty input
without forking base64 (base64 of "" is "" anyway, so the wire format
is unchanged). A passing test's title, hook message and output are all
empty, so this removes three forks per test. Also short-circuit
decode_base64 on empty input.

No behaviour change. Closes #762.
@Chemaclass Chemaclass added the enhancement New feature or request label Jul 11, 2026
@Chemaclass Chemaclass self-assigned this Jul 11, 2026
@Chemaclass Chemaclass merged commit 902fcb3 into main Jul 11, 2026
31 checks passed
@Chemaclass Chemaclass deleted the perf/762-base64-empty-fork branch July 11, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant