ok/jj
1
0
Fork 0
forked from mirrors/jj
jj/cli
Yuya Nishihara 32afea198a templater: relax operator precedence rule to reduce possibility of large reparse
After upgrading pest from 2.7.8 to 2.7.9, I noticed CLI tests got significantly
slow (something around 40sec -> 60sec on my laptop.) I suspect this would be
caused by detailed error state tracking introduced in 2.7.9, but it's also true
that our template grammar exercises such code path.

My understanding is that PEG is basically a top down parsing with unlimited
lookahead. Before this change, the default commit_summary template would be
parsed as follows:
 1. parse the outermost separate(..) as "term"
 2. "concat" rule can't continue, so
 3. reparse the whole string as "expression"
Because this pattern is not uncommon, I think it's better to rewrite the
grammar to avoid large retry.

With this patch, our tests runs within ~50sec under debug build. It appears to
save a few milliseconds in release build, but my development environment isn't
quiet enough to say the difference is significant.
2024-04-04 23:46:32 +09:00
..
examples cli: use RevisionArg type in "resolve -r", "bench", and example command 2024-04-03 15:30:30 +09:00
src templater: relax operator precedence rule to reduce possibility of large reparse 2024-04-04 23:46:32 +09:00
testing
tests Rename the "AMOUNT" argument for jj prev and jj next to OFFSET 2024-04-04 09:32:29 -04:00
build.rs
Cargo.toml
LICENSE