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

Excessive String Creation #58

Open
stevenjbaldwin opened this issue Oct 21, 2019 · 1 comment
Open

Excessive String Creation #58

stevenjbaldwin opened this issue Oct 21, 2019 · 1 comment
Assignees

Comments

@stevenjbaldwin
Copy link
Contributor

When using the SOM_LEFTMOST expression flag, all matching strings are returned within the returned list of match objects. For large strings (1+MB) and certain regexps this could cause orders of magnitude more strings to be created. If the scan method could return these strings as a lazy collection such as a Stream instead of a List, this could avoid consuming too much heap memory via the string pool. Alternatively, just the start and end offsets could be returned so the caller can control the number of strings created.

@gliwka
Copy link
Owner

gliwka commented Oct 21, 2019

Interesting use case. Returning a stream definitely makes sense for large amount of matches. I'll take a stab at implementing it. Will actually need this soon. too.

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

No branches or pull requests

2 participants