[webkit-dev] What regular expressions do we spend time evaluating?

Maciej Stachowiak mjs at apple.com
Sat Jun 28 14:55:31 PDT 2008


On Jun 28, 2008, at 11:39 AM, Darin Adler wrote:

> Since SunSpider time now is about 10% inside the regular expression
> matcher, it's time to reconsider regular expression optimizations. In
> particular, we should see if we can find a subset of regular
> expressions where we can implement a more efficient matching  
> algorithm.
>
> I wrote code to dump a histogram of time spent matching regular
> expressions: <https://bugs.webkit.org/show_bug.cgi?id=19801>.
>
> Here's the result from running SunSpider on my computer. The column on
> the left is the number of seconds spend matching an expression, and
> the column on the right is the expression:
>
> I wish we had a test with some better regular expression coverage!

Besides the big all-regexp test, there's some other regexp usage on  
SunSpider, including JSON validation.

> Here's one other case with some significant regexp time in it, I think
> perhaps from JSON validtion? Loading 280slides.com and looking at the
> test presentation:

Some of these look like the usual JSON suspects.

>
> I had a hard time finding pages and tests where regular expressions
> took enough time to be worth looking at.

We could use the stress tester to find pages that use regexps at load  
time.

  - Maciej



More information about the webkit-dev mailing list