RESOLVED FIXED 76079
v8-regexp spends 35% of its time allocating and copying internal regexp results data
https://bugs.webkit.org/show_bug.cgi?id=76079
Summary v8-regexp spends 35% of its time allocating and copying internal regexp resul...
Michael Saboff
Reported 2012-01-11 10:51:10 PST
35% of v8-regexp processing is spent allocating and copying match results data. RegExpConstructor currently takes a pointer to a RegExpConstructorPrivate object that is malloced. When a RegExpMatchesArray is created, it too mallocs a RegExpConstructorPrivate object and copies the data from the RegExpConstructor instance of the same class. The RegExpConstructorPrivate has more attributes than needed for RegExpMatchesArray uses. The two mallocs and some of the copying can be eliminated.
Attachments
Patch for review (16.12 KB, patch)
2012-01-11 11:00 PST, Michael Saboff
ggaren: review+
Michael Saboff
Comment 1 2012-01-11 10:53:33 PST
Michael Saboff
Comment 2 2012-01-11 11:00:29 PST
Created attachment 122052 [details] Patch for review
Michael Saboff
Comment 3 2012-01-11 11:01:02 PST
Actually the performance benefit is 24%. I will change the ChangeLog.
Geoffrey Garen
Comment 4 2012-01-11 13:41:00 PST
Comment on attachment 122052 [details] Patch for review View in context: https://bugs.webkit.org/attachment.cgi?id=122052&action=review r=me > Source/JavaScriptCore/runtime/RegExpConstructor.cpp:100 > +RegExpResult& RegExpResult::operator=(const RegExpConstructorPrivate& rhs) Should this be inlined? > Source/JavaScriptCore/runtime/RegExpConstructor.cpp:143 > RegExpMatchesArray::~RegExpMatchesArray() You can remove this entirely -- that will make Mark's work a little easier. > Source/JavaScriptCore/runtime/RegExpMatchesArray.h:120 > + RegExpResult privateData; Minor nit: I would call this variable "regExpResult". The class can have an arbitrary amount of private data -- what's unique about this data is that it's a regular expression result. > Source/JavaScriptCore/runtime/RegExpMatchesArray.h:121 > + bool m_filledArrayInstance; Minor nit: I prefer the style of prefacing boolean predicates with "did" -- "m_didFillArrayInstance". Otherwise, it's ambiguous whether "filledArrayInstance" is a boolean predicate or a noun.
Geoffrey Garen
Comment 5 2012-01-11 13:41:28 PST
Correction: "m_regExpResult".
Michael Saboff
Comment 6 2012-01-11 15:27:24 PST
Note You need to log in before you can comment on or make changes to this bug.