You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Quadratic parse of large top-level { ... } groups (nvm.sh -n takes 52s vs instant) #130
Found by the open-source corpus scan (nvm-sh/nvm — nvm.sh is one giant top-level brace group; -n takes 51-58s, source ~52s, nvm-exec times out; semantics are correct, purely a perf cliff).
Reproducer: synthetic { + 1200 × x=1 + } parses in 4.2s while the same statements without braces take 0.2s (GNU: instant both ways).
GNU owner: grammar-based group parse, O(n).
Rubash owner: likely re-lex/re-scan per line-group in src/parser/brace_command.rs / src/lexer/brace_scan.rs (skip_brace rescans the accumulated body per joined line).
Artifacts: target/gc/corpus-web/summary.txt finding 3, synthetic reproducer in raw/repro/.
Activity
caomengxuan666 commentedon Sep 26, 2026
性能专项(target-perf/REPORT.md,release 构建)已确证本项为 O(N².00) 并定位热点:
src/lexer/mod.rs:351每读一条物理行就对整个累积缓冲区重跑 tokenize_plain(mod.rs:340-345 注释自认),叠加 :318/:321/:326 三个 O(L) 全缓冲 has_unclosed_* 扫描;次因 support.rs:308 嵌套重扫。nvm.sh 形态(单{组跨 N 行)1000/2000/4000 行 = 896/3588/14263ms(×2 行 → ×4 时间),GNU 9.7ms = 1469×。修复方向 = 增量 tokenize(LexerParseState 重放机制已在);与 #131 的按命令边界增量解析设计同族,可共用车道推进。perf 跟踪单已开(本轮 #155-#159)。perf-suite: dedicated benchmark harness + first baseline (24 probes, …
corpus3 lane: git test harness / FFmpeg + OpenSSH configure / bash-it…
perf(lexer): skip duplicate comsub scan at the join gate (perf5 re-land)