Repository navigation
perf(cond): direct numeric leaf + extglob-skip + decimal fast path - #966
Merged
Merged
Conversation
…path Per-evaluation cost of the `[[ a -op b ]]` conditional-arithmetic leaf (test.c:357 arithcomp; execute_cmd.c:4024 cond_expand_word), minimal cuts: - `is_conditional_numeric_op` becomes the one owner for the six arithcomp spellings, replacing two duplicated `matches!` lists. - `conditional_status_with_metadata` handles the arithmetic-comparison leaf directly instead of returning None and re-running `execute_conditional` (a second `conditional_outer_parentheses` + `conditional_logical_index` x2 pass). A `(` token changes the token shape and still falls through to the extglob-merge path, so this is admission, not a semantic shortcut (rubash#117). - `needs_extglob_reassembly` guard: `execute_conditional` borrows the input slice when no word ending in an extglob operator is followed by `(`, skipping the whole-Vec clone. - `cond_arith_decimal_literal` whitelist fast path in `conditional_numeric_binary_status`: two plain decimal operands (non-empty ASCII digits, no multi-digit leading zero, fitting intmax_t) skip cond_expand_word + expand_arith_indexed_subscripts + arith_dynamic_context + eval + flush + sync. GNU test.c:357 arithcomp -> evalexp is the identity for them. Octal/sign/overflow/`$`/`[`/quote-carrier spellings return None and keep the full path. - `conditional_numeric_matches` shares the comparison verdict between the fast and full paths so they cannot drift. `xtrace_conditional_term` already returns before `format!` when xtrace is off (prompt_expansion.rs:687 xtrace_enabled guard) — unchanged. Verified byte-identical to GNU bash 5.3.20 on a 32-case `[[ ]]` differential plus xtrace rendering. lib 674 pass; arith_cache_fallback 7, issue322 9, issue505 15, issue460 19, typed_cell_coherence_fuzz 2 pass. Bench best-of-3 vs bash: `[[ 1 -eq 2 ]]` 50k 1.41x -> 1.10x; `[[ i -lt 15000 ]]` 30k 1.33x -> 1.26x; bench-full `arith-cond 50k` (`((i%2)) && x=1 || x=2`) unchanged ~2.9x — it never enters this path.
caomengxuan666
added a commit
that referenced
this pull request
Oct 21, 2026
…est platform status, current architecture (#982) * docs(readme): overhaul — Performance section with pinned numbers, honest platform status, current architecture - New Performance section, every number pinned to its measuring issue/PR: - Android-matrix interpreter triage closed with numbers (#607/#608/#609 -> #665/#671/#679, #666, #672/#678; net ~1.06x GNU scalar assign) - array store O(n^2)->O(1) amortized (#618/#616: assoc 445x->9.9x, indexed 736x->3.8x vs GNU at 5000 keys; docs/performance.md ledger) - literal fast-path wave with measured deltas: #967 (177->155 ms), #966 (1.41x->1.10x), #974 (~11%), #959 (3.65x->3.16x), #958 (-10%), #956/#973/#954 family - export/unset economics: #916 measured costs stated, write lane landed (#917/#918/#920, #943 correctness rework), issue open on residual - Windows process economics: #913 one hidden console per session (~22 ms/spawn -> <=1 per session; tests/console_window_gate.rs), #884 tput inline arm (1165 ms -> 47 ms, 269-row oracle matrix), WinuxCmd#1269 twin (~17 ms -> ~0.4 ms in-process), #800 face B open - Platform status made verifiable: Linux CI lanes + upstream-corpus replay job named; 19/24 Linux pass dated and cited (#500) instead of 'and climbing'; macOS now runs lib tests in CI, not just compiles - Architecture tree updated to the real src/ layout (bin/expand/fd/jobs/ shell added); builtin count 40+ -> 62 engine builtins per the test-guarded docs/builtins.md + hidden fast-path builtins - Testing section: regression suite, console gate, corpus replay commands - Compatibility baseline line updated to vendored Bash-5.3 patch 20 (#957) with local+WSL 5.3.20 oracles (#978) - zh README rewritten to full parity with EN (was still describing the pre-dialect path model, missing the identity section, claiming 5.3.0) - Last-updated stamp refreshed * docs(readme): date the Linux corpus pass from the archive — 2026-09-27 wt4/linuxrun, 17/24 per its own ledger The "(2026-09-26, #500)" tag was wrong on both counts: 09-26 is the earlier "not-yet-usable" judgment (first smoke 8/10, gap-ledger C4) that the 2026-09-27 wt4/linuxrun lane explicitly declared obsolete, and #500 only carried the figure forward — it is not the measuring record. No archived record supports 19/24: the lane's own corpus-slice table (docs/LINUX-RUN-STATUS.md, deleted in #478, archived in #477 section 4 and #581) tallies 17 suites at 0 diff + trap/redir/glob/extglob/new-exp/ read/ifs-posix with diffs = 17/24. README now reads "17/24 byte-identical (2026-09-27 wt4/linuxrun lane, ledger archived in #477/#581)" in both the platform-status paragraph and the compatibility table, EN + zh-CN at parity. Addresses review comment 6319063190 on #982. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The [[ ]] numeric path ran the full metadata scan, returned None on the numeric leaf, then re-ran execute_conditional (double outer/||/&& scan) plus a whole-Vec extglob clone. Fix: is_conditional_numeric_op single owner, numeric leaf handled directly, needs_extglob_reassembly borrow guard, cond_arith_decimal_literal whitelist (plain decimals skip expand/subscript/eval/flush/sync; octal/sign/overflow fall back). GNU test.c:357 arithcomp, execute_cmd.c:4024. Note: bench-full arith-cond label is ((i%2))&&x=1||x=2 dispatch, not this path - noted for separate task. Tests: lib 674 green, 32-case GNU diff byte-identical. [[ 1 -eq 2 ]] 50k: 1.41x->1.10x.