Skip to content

Optimisation: if none of the resolvers need capture information capturing is unnecessary #1

@masklinn

Description

@masklinn

Probably not useful for the initial release but something to consider for later. This could be done three ways:

  • add that information as a flag to the repl from construction
  • pre-check the resolvers at extraction
  • capture lazily instead of eagerly

The first two complicate resolution as it means resolve has to be duplicated to handle the None/Replacement cases separately, the latter probably just means constructing the capture once using OnceCell (/ LazyCell) instead of using a Capture parameter.

Later clarification for myself: this is about calling re.capture during extraction e.g.

let c = re.captures(ua)?;

::None and ::Replacement resolver variants have no need for the capture data, although that means resolve would need to be faillible. Then again, we could just expect/unwrap since by definition matching should only yield matching regexes, so captures should always succeed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions