Problem
assert_contains_ignore_case (src/assert.sh, ~lines 293-320) lowercases both operands with a printf | tr pipe each — 2 subshell forks per call:
expected_lower=$(printf '%s' "$expected" | tr '[:upper:]' '[:lower:]')
actual_lower=$(printf '%s' "$actual" | tr '[:upper:]' '[:lower:]')
Lower priority than #844 (this assertion is less common), but same class of avoidable per-call fork.
Bash 3.0+ constraint (why the obvious fixes are out)
${var,,} — Bash 4.0+. Forbidden.
shopt -s nocasematch — Bash 3.1+. Forbidden (hard floor is 3.0; CI runs a 3.0 job).
- So
tr stays the portable lowercasing tool.
Possible fixes (pick the one that measures best and stays 3.0-safe)
- Collapse two forks into one — lowercase both operands in a single
tr pass over a delimited string, then split. Saves one fork per call.
- Herestring instead of pipe —
tr ... <<< "$s" avoids the printf subshell (one fork instead of two per operand). Confirm <<< behavior on Bash 3.0.
- Leave as-is if neither is a clean, provable win — acceptable outcome; document why.
Do NOT regress correctness for a micro-fork. Bench first.
Acceptance criteria
Problem
assert_contains_ignore_case(src/assert.sh, ~lines 293-320) lowercases both operands with aprintf | trpipe each — 2 subshell forks per call:Lower priority than #844 (this assertion is less common), but same class of avoidable per-call fork.
Bash 3.0+ constraint (why the obvious fixes are out)
${var,,}— Bash 4.0+. Forbidden.shopt -s nocasematch— Bash 3.1+. Forbidden (hard floor is 3.0; CI runs a 3.0 job).trstays the portable lowercasing tool.Possible fixes (pick the one that measures best and stays 3.0-safe)
trpass over a delimited string, then split. Saves one fork per call.tr ... <<< "$s"avoids theprintfsubshell (one fork instead of two per operand). Confirm<<<behavior on Bash 3.0.Do NOT regress correctness for a micro-fork. Bench first.
Acceptance criteria
assert_contains_ignore_casebehavior unchanged (existing tests green; add one if the lowercase path is under-covered)../bashunit tests/+./bashunit --parallel --simple --strict tests/green.make sa,make lint,./build.sh --verifygreen.${var,,}, nonocasematch, noprintf -v).