-
Notifications
You must be signed in to change notification settings - Fork 61
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
Optimize LIKE pattern compilation and make LIKE pattern compilation interruptible. #279
Conversation
In two ways: - Change fold/union operations to accumulate to a single list. - Replace *ordered* sets and maps to hash sets and maps. This results in a > 10x improvement in compiling large like patterns (i.e. 1000 characters and up).
Codecov Report
@@ Coverage Diff @@
## master #279 +/- ##
============================================
+ Coverage 82.44% 82.45% +0.01%
Complexity 1202 1202
============================================
Files 155 155
Lines 9283 9293 +10
Branches 1522 1524 +2
============================================
+ Hits 7653 7663 +10
- Misses 1175 1176 +1
+ Partials 455 454 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
nfaStates.forEach { state -> | ||
addAll(state.getOutgoingStates(it)) | ||
|
||
if (Thread.interrupted()) { | ||
throw InterruptedException() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the change in this PR that results in the biggest performance improvement. The other stuff is incremental.
4954e9c
to
d53ef3d
Compare
Superseded by #286. |
On
master
this expression takes on average 37 seconds to compile:'foo' like '%<n>%'
(<n>
is 1500!
characters)With this change, on average it takes ~2.6 seconds to compile.
This is still an order of magnitude slower than it really needs be, but is (comparatively speaking) much better and all that I can do in the short term.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.