Details
Description
We noticed our jbehave tests taking a long time. Mostly our fault, but also a surprising amount of time spent in Matcher.find() from RegexStoryParser, said the profiler. Who knew? Turns out, that happens when you call find() on long lines and your regex starts with .* , as this guy explains:
http://www.fasterj.com/articles/regex2.shtml
So we removed it, and our tests ran a little faster. (We removed it only from the expressions used with find(); we didn't touch the ones using matches().)
And your tests run a lot faster!
Unfortunately, I don't know how to prevent regression here. I don't see performance tests, and the behavior didn't change. (You can note how long things take on the continuous integration server, though.) And it's pretty easy to imagine someone coming through and making the regular expressions all look the same. Still, there you have it.
Activity
Field | Original Value | New Value |
---|---|---|
Summary | speed up RegexStoryParser by removing leading .* | Speed up RegexStoryParser by removing leading .* |
Fix Version/s | 3.6 [ 17721 ] |
Assignee | Mauro Talevi [ maurotalevi ] | |
Fix Version/s | 3.5.4 [ 18081 ] |
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Resolved [ 5 ] |
Applied with thanks.
Also created a examples/performance module where we can verify the performance related behaviour.
Feel free to contribute any story of which you'd want to test performance issues.