On Tue, Jul 9, 2024 at 8:48 PM Jeff King <peff@xxxxxxxx> wrote: > On Mon, Jul 08, 2024 at 04:06:47PM -0400, Eric Sunshine wrote: > > One thing we may want to measure is how much extra time we're wasting > > for the (very) common case of latching heredoc bodies only to then > > ignore them. In particular, we may want to add a flag to ShellParser > > telling it whether or not to latch heredoc bodies, and enable that > > flag in subclass ScriptParser, but leave it disabled in subclass > > TestParser since only ScriptParser currently cares about the heredoc > > body. > > I doubt it's much to hold on to a few extra small buffers. I was more concerned about the extra substr() consuming additional CPU time and inflating wall-clock time. > So it does seem to make a small difference, but we're within the noise. Okay. Thanks for measuring. > > In the long run, I think we probably want to build a full parse tree, > > attach relevant information (such as a heredoc body) to each node, and > > then walk the tree, rather than trying to perform on-the-fly lints and > > other operations on the token stream as is currently the case. > > [...] > > Yeah, all of that sounds very sensible long term, but probably not worth > worrying about for this topic. Agreed.