Closed zikaeroh closed 3 years ago
Thanks - it looks like the method assumes that Run has been called at least once, which isn't documented that way. I'll fix that.
It's a bit of an edge case to call Subshell on a runner that hasn't been used for anything, though. It's practically equivalent to just creating a new runner.
Thanks for the fix.
In my case, I found that calling subshell on the unused runner was twice as fast as making a new runner each time with the same setup; this change unfortunately appears to remove most of that performance benefit (though not all of it).
The syntax parser and printer were pretty heavily optimized years ago, but the runner has only had fairly basic work done. For a while it didn't make sense to heavily optimize the code given that it lacked features and would likely be refactored, but we're at a point now where it probably makes sense.
If you have any suggestions in mind, or a benchmark/pprof that points at a culprit, I'm happy to look into it.
Reproduction: https://play.golang.org/p/XOOqXzF6VGV
Hit this in a benchmark of embedded languages; I call
Subshell
to obtain clones of the original runner.