Skip to content

Use minimal regex/fancy-regex build features to reduce build size - #75

Open
bendavis78 wants to merge 1 commit into
shssoichiro:masterfrom
bendavis78:minimal-regex
Open

Use minimal regex/fancy-regex build features to reduce build size#75
bendavis78 wants to merge 1 commit into
shssoichiro:masterfrom
bendavis78:minimal-regex

Conversation

@bendavis78

Copy link
Copy Markdown

When building a WASM module that uses zxcvbn-rs, I found I was able to reduce the build size by roughly 25% by setting the regex and fancy-regex package features to use only standard library support, and avoid using unicode character classes such as \s.

This PR replaces \s with \t\r\n in MAYBE_DATE_WITH_SEPARATOR_REGEX, and sets features = ["std"] on the regex and fancy-regex dependencies.

See here for more info on this optimization for the regex dependency: https://github.com/rust-lang/regex?tab=readme-ov-file#crate-features.

@shssoichiro

Copy link
Copy Markdown
Owner

Looks like there's a feature missing on one of the dependencies, that's conditionally required for wasm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants