I'm using with_state for subparsers and am pre-allocating with a bigger capacity.
This could be optimized by taking a closure which removes the early allocation and only allocates when the parser is actually tried.
With or without that, one could additionally use the already implemented on_save and on_rewind Inspector methods to try to reuse the allocations from a state by rewinding to a save that was directly taken when the state was created.
I'm using
with_statefor subparsers and am pre-allocating with a bigger capacity.This could be optimized by taking a closure which removes the early allocation and only allocates when the parser is actually tried.
With or without that, one could additionally use the already implemented
on_saveandon_rewindInspectormethods to try to reuse the allocations from a state by rewinding to a save that was directly taken when the state was created.