Skip to content
This repository was archived by the owner on Apr 2, 2026. It is now read-only.

with_state could be optimized #937

@DasLixou

Description

@DasLixou

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions