Bug 18086 - Matching of regexps with ^ could be much faster
Summary: Matching of regexps with ^ could be much faster
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Eric Seidel (no email)
URL:
Keywords:
: 18087 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-03-25 15:38 PDT by Eric Seidel (no email)
Modified: 2008-03-31 01:02 PDT (History)
1 user (show)

See Also:


Attachments
Make matching of regexps using ^ much faster (4.63 KB, patch)
2008-03-25 15:39 PDT, Eric Seidel (no email)
no flags Details | Formatted Diff | Diff
Test case which shows bug (warning, will hang Safari!) (343 bytes, text/html)
2008-03-25 15:45 PDT, Eric Seidel (no email)
no flags Details
Make matching of regexps using ^ much faster (6.79 KB, patch)
2008-03-25 15:57 PDT, Eric Seidel (no email)
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2008-03-25 15:38:18 PDT
Matching of regexps with ^ could be much faster

try /^bar/ on a really long string and watch Safari go off the deep end...  It should immediately be able to detect that ^bar doesn't match.
Comment 1 Eric Seidel (no email) 2008-03-25 15:39:20 PDT
Created attachment 20049 [details]
Make matching of regexps using ^ much faster

 JavaScriptCore/pcre/pcre_compile.cpp |   20 ++++++++++++--------
 JavaScriptCore/pcre/pcre_exec.cpp    |   32 ++++++++++++++++++++++++--------
 JavaScriptCore/pcre/pcre_internal.h  |    2 ++
 3 files changed, 38 insertions(+), 16 deletions(-)
Comment 2 Eric Seidel (no email) 2008-03-25 15:44:11 PDT
*** Bug 18087 has been marked as a duplicate of this bug. ***
Comment 3 Eric Seidel (no email) 2008-03-25 15:45:31 PDT
Created attachment 20051 [details]
Test case which shows bug (warning, will hang Safari!)
Comment 4 Eric Seidel (no email) 2008-03-25 15:49:26 PDT
I'm not sure where to put the test case.  I guess I could put it in LayoutTests/fast/js/
(and make it "pass" if it completes w/o timing out).
Comment 5 Eric Seidel (no email) 2008-03-25 15:57:48 PDT
Created attachment 20054 [details]
Make matching of regexps using ^ much faster

 JavaScriptCore/pcre/pcre_compile.cpp               |   20 +++++++-----
 JavaScriptCore/pcre/pcre_exec.cpp                  |   32 +++++++++++++++-----
 JavaScriptCore/pcre/pcre_internal.h                |    2 +
 LayoutTests/ChangeLog                              |   10 ++++++
 .../fast/js/ascii-regexp-subject-expected.txt      |    5 +++
 LayoutTests/fast/js/ascii-regexp-subject.html      |   13 ++++++++
 .../fast/js/resources/ascii-regexp-subject.js      |   18 +++++++++++
 7 files changed, 84 insertions(+), 16 deletions(-)
Comment 6 Darin Adler 2008-03-26 07:18:51 PDT
Comment on attachment 20054 [details]
Make matching of regexps using ^ much faster

r=me
Comment 7 Darin Adler 2008-03-28 09:07:37 PDT
Assigning to Eric, assuming that he will check it in.
Comment 8 Eric Seidel (no email) 2008-03-31 01:02:24 PDT
r31454