Speed up RegexStoryParser by removing leading .*

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.

Assignee

Mauro Talevi

Reporter

Laura Dean

Labels

None

Components

Fix versions

Affects versions

Priority

Major
Configure