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

Implement literals optimization #59

Closed
nitely opened this issue Apr 4, 2020 · 0 comments · Fixed by #68
Closed

Implement literals optimization #59

nitely opened this issue Apr 4, 2020 · 0 comments · Fixed by #68
Labels
feature New feature

Comments

@nitely
Copy link
Owner

nitely commented Apr 4, 2020

This seems like a really useful optimization. When the regex contains a literal, we can skip over the text until the first letter is found (i.e: calling memchr). Nim's re find and findAll are at least an order of magnitud faster because of this.

It should likely be part of another package that implements fast multi-literal searching foo|bar|baz, using both memchr when there's one or two literals, and a DFA or Aho–Corasick algorithm. It should also support unicode (memchr should search the Rune's last byte).

Then nim-regex can find the literal position and then match backward and forward.

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

Successfully merging a pull request may close this issue.

1 participant