Skip to content

[perf] 解析吞吐残余(#130/#155/#176/#178 关闭后):nvm.sh -n 852x / nvm load 379x / configure 头 357x / 全量 configure 超时 / flat8000 123x / nst1 96x / rep40 65x #241

Closed

Description

@caomengxuan666

来源

perf-suite 车道首个可复现基准(scripts/run-perf-suite.sh + benchmarks/,基线表 docs/PERF-BASELINE.md,rubash 9bf2df9 debug vs WSL GNU bash 5.3.0 owner-compiled,2026-09-27)。此前 #130/#155/#176/#178 均已关闭,但同族形态在当前基点仍远未达标:

探针 形态 rubash GNU 比值
benchmarks/23-nvm-parse-n.sh nvm.sh v0.40.8 -n 18748ms 22ms 852x
benchmarks/24-nvm-load.sh source nvm.sh 14402ms 38ms 379x
benchmarks/21-configure-head1374-n.sh GNU bash configure 前 1374 行 -n 3211ms 9ms 357x
benchmarks/22-configure-full-n.sh 全量 configure(24753 行)-n >120s 46ms TIMEOUT
benchmarks/16-parse-flat8000.sh 8000 行赋值执行 2219ms 18ms 123x
benchmarks/18-nested-brace-nst1-d200.sh 单行嵌套深度 200(#176 nst1) 579ms 6ms 96.5x
benchmarks/20-as-fn-mkdir-p-rep40.sh as_fn_mkdir_p 单元 ×40(#178) 521ms 8ms 65.1x
benchmarks/17-parse-flat8000-n.sh 同 16 但 -n 510ms 13ms 39.2x

附带兼容问题(解析中止,非纯性能)

复现

cargo build && bash scripts/run-perf-suite.sh --probe nvm   # 或 21 / 22 / 16 / 18 / 19 / 20

产物:target/perf-results/{rubash,gnu}.tsv;基线:docs/PERF-BASELINE.md。

Activity

  1. added
    enhancement
    on Sep 27, 2026
  2. caomengxuan666 commented on Sep 27, 2026

    @caomengxuan666
    MemberAuthor

    部分修复已合入 master(commit dec78e74):{/}} 词规则(syntax.h:29-30 + parse.y:3168/3174/5899——GNU 一样报 command not found)与游离 ;;/;&/;;& 分隔符类(parse.y:3711 SEMI_SEMI、列表文法 :1264-1290)已修,35 形状矩阵 34 字节一致(1 个为既有后台输出序差异)。剖析结论:重词法化已排除嫌疑(AST 一次性构建),热成本是合法展开工作;诊断 DFA 白名单省 ~5%。剩余:configure:5345 与 nst2 深度≥3 两项确认为 brace_scan_cache/skip_brace 族(与已修的深度≥4 洞同族不同形状),解析吞吐残余(nvm -n 852x 等)待增量读取器深水项。

  3. added 3 commits that reference this issue on Sep 27, 2026
  4. caomengxuan666 commented on Sep 28, 2026

    @caomengxuan666
    MemberAuthor

    perf3 round (wt7/perf3 @ c17b6cea) progress on the parse-throughput family — re-scoped with numbers, stays OPEN:

    probe 92de75b base perf3 with captain's proposed continuation.rs diff (temp-applied, not committed)
    17-parse-flat8000-n 510ms / 39.2x 390ms / 27.9x —
    20-as-fn-mkdir-p-rep40 521ms / 65.1x 486ms / 54.0x —
    21-configure-head1374-n 3558ms / 395.3x 3448ms / 383.1x 2606ms / 289.6x
    23-nvm-parse-n 12472ms / 623.6x 12254ms / 644.9x 2607ms / 137.2x
    22-configure-full-n TIMEOUT TIMEOUT TIMEOUT (still >120s, no output at 100s — parse-phase super-linear cost, distinct from the ${\u00a0scans)
    24-nvm-load 14402ms / 379x 8116ms / 208x —

    Landed: batch-tokenizer complete-command-boundary checkpoint (tokenize_plain re-lex 0.98s→~0.5s on nvm -n) + brace_scan.rs ${-arm zero-copy scans (the mod.rs-side twin of continuation.rs's O(n\u00b2) copies). nvm -n decomposition at base: 4.54s whole-input prescan + 5.33s per-line has_unclosed_quotes (both continuation.rs, captain-exclusive — proposed diff in docs/PERF-BASELINE.md perf3 round) + 0.98s tokenize + ~1.6s parse/reader. The <60x target needs the captain's fix plus the ~1.6s parse/reader phase (GNU: 19ms total). Verification: byte-identical GNU matrices (multi-line logical-line suites), regression 24/24.

  5. added 2 commits that reference this issue on Sep 28, 2026
  6. caomengxuan666 commented on Sep 28, 2026

    @caomengxuan666
    MemberAuthor

    perf4 round (wt8/perf4) progress on the parse-throughput family — re-scoped with numbers, stays OPEN:

    probe lane base (9a13e8f, morning) perf4 back-to-back A/B vs pristine base (same load)
    23-nvm-parse-n 2640ms / 132.0x 1643ms / 65.7x (<80x target MET) 3029 -> 1737ms (-43%)
    24-nvm-load 3611ms / 95.0x 2625ms / 51.5x 3180 -> 2227ms (-30%)
    21-configure-head1374-n 2554ms / 283.8x 670ms / 67.0x 2742 -> 636ms (-77%)
    22-configure-full-n TIMEOUT TIMEOUT (still >120s) prefix curve: 3000L 11.0s->1.4s; 6000L 118s->5.5s; 9000L 107s->35.8s
    17-parse-flat8000-n 390ms / 39.2x 304ms / 23.4x 390 -> 268ms (-31%)

    Landed (8 changes, 13 files): Rc threading of diagnostic/source text through compound-body re-parses (was 272MB of whole-script clones on nvm -n — ~1500 nested body parses each cloned the full 173KB); duplicate comsub scan eliminated in the join loop; admission gates + false-answer caches on the comsub/compound/${ join scans; per-token ( depth scan gated on a literal $(printf "%s\nn" "$as_dir" | sed "s/'/'\\''/g";; #'(. Reproducer: target/perf4/q5.sh = the 44-line as_fn_mkdir_p function + echo ok + echo ok2 prefixed with # set -o posix — GNU bash -n rc=0; the grouped driver's scan keeps the group open through all 46 lines.
    2. The tokenize-based keyword-stack stage of stdin_source_needs_more keeps groups open on if/case false positives in the same stretch.
    With those fixed the groups stay small and the incremental machinery landed this round is already linear. Full decomposition in docs/PERF-BASELINE.md perf4 round.

  7. caomengxuan666 commented on Sep 28, 2026

    @caomengxuan666
    MemberAuthor

    Correction to the previous comment (shell command-substitution ate a phrase): the fourth landed change reads "per-token comsub-depth scan gated on a literal dollar-paren byte pair" — i.e. the parse loop's unclosed_command_substitution_depth consult on every word token is now admitted on the presence of the two bytes $(; and the quoted reproducer is configure line 337, the m4sh sed-quoting arm inside as_fn_mkdir_p. Full details, evidence and the honest acceptance scorecard are in docs/PERF-BASELINE.md, perf4 round section.

  8. caomengxuan666 commented on Sep 28, 2026

    @caomengxuan666
    MemberAuthor

    perf4 continuation recovered (master ae7f60f): the history driver's inline gather was re-expanding + re-tokenizing the whole accumulated pending per line (configure-head1374: 13.3MB expand/13.3MB tokenize on a 38KB script). It now feeds through the sourcefix group feeder (GNU parse.y:3557 read_token streaming / evalfile.c per-command reads / parse.y:3249 alias-per-token with the table frozen during gather).

    Numbers (debug, A/B vs clean master, medians): configure-head1374-n 2478ms -> 656ms (-74%), nvm-parse-n 2395 -> 1890 (-21%), flat8000-n 397 -> 303 (-24%), nvm-load -8%. GNU-diff matrix m1-m4 byte-identical; new m5 group-boundary probe (history list per group across multiline quotes/heredocs/function bodies/case/if/&&/continuations/live-table aliases incl. alias-opens-quote) master==lane byte-identical; real configure corpus 106/106 group boundaries match.

    Remaining (recorded for the next round): configure-full -n still has the completeness-test half's quadratic — needs the resumable scanner state (exactly what wt10/contperf is building for #292); #242c hot-path -25% not reached (distributed expansion mechanism); nvm-parse-n at 105x vs GNU's 18ms.

  9. added 4 commits that reference this issue on Sep 28, 2026
  10. caomengxuan666 commented on Oct 3, 2026

    @caomengxuan666
    MemberAuthor

    wt65/p241 round (2026-10-04, base 5f7b1ab): honest no-go on both sanctioned attacks — inline-section extension ceiling 3.13ms (1.7%; the historic 91-108ms 'two-pass cost' was nesting-double-counted inclusive sum), Rc token store 3.03-3.35ms (1.8%, unchanged from parse4). Tree unchanged.

    Re-baseline: the seven post-parse4 fix commits made the tree FASTER — nvm -n 230.8→183.8ms quiet (-17%), nvm load 322.8→61.1ms (-81%), configure-head1374 1081.7→67.8ms (parse4's figure was an outlier).

    Redirect (the recorded next target): the nvm -n wall is now 46% lextok (84.7ms — join/re-lex + parked scanners + finish_word_token) = the #281/#292 incremental-reader family (continuation.rs-adjacent), not the parse layer. #241's remaining headroom lives there; next perf lane should attack #281's batch tokenizer. Artifacts: rubash-wt-p241/target/p241/ (leaf timers, base binary preserved).

  11. added
    P2-medium
    on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2-mediumenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions