zxcvbn-rs icon indicating copy to clipboard operation
zxcvbn-rs copied to clipboard

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

Open bendavis78 opened this issue 1 year ago • 1 comments

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.

bendavis78 avatar Feb 20 '24 23:02 bendavis78

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

shssoichiro avatar Mar 01 '24 13:03 shssoichiro