Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to or support regex-lite #18

Open
Dav1dde opened this issue Aug 14, 2024 · 1 comment
Open

Switch to or support regex-lite #18

Dav1dde opened this issue Aug 14, 2024 · 1 comment

Comments

@Dav1dde
Copy link

Dav1dde commented Aug 14, 2024

I haven't run the numbers yet for this crate, but I did for ua-parser which brings down memory consumption significantly.

I was initially just going to PR the change, but since this crate supports full unicode and no unicode modes (is there a usecase for full unicode?), this is not as easy since regex-lite does not support unicode. So it would only be possible to switch the non-unicode codepath to regex-lite. Which means the regex dependency can't be fully replaced.

What would be your preferred approach?. I have a these proposals:

  1. Add regex-lite with a feature flag and only enable it for the non-unicode codepath (might be quite unergonomic code wise since we'll end up with a wrapper type for the regex dispatching to either regex or regex-lite).
  2. Drop unicode support and switch fully to regex-lite
  3. Do nothing

What are your thoughts?

@Dav1dde
Copy link
Author

Dav1dde commented Aug 15, 2024

It seems like the performance hit may not be desirable and is much more than I anticipated. It may still make sense as an opt-in for environments where the user wants to prioritize resources constraint environments, e.g. when unicode is disabled and the regex-lite feature flag is enabled.

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

No branches or pull requests

1 participant