Hi, I compared the following two in JSC and in v8: A: result = str.match(regex); B: while (regex.exec(str)) ++count; str was about 20M input, and regex was /./gm JSC: A: 618 ms B: 3469 ms V8: A: 2640 ms B: 1833 ms I was quite surprised that although the result is a really huge array, str.match was much faster in JSC. Is there a known reason to that? Can B be improved in JSC? Regards, Zoltan
Interesting question, we'd have to profile. I don't think your loop calling exec should be triggering any allocations, so my guess would be that the overhead is in calling out from JS JIT code to Yarr JIT code via a couple of layers of C functions. I started doing some work towards making it easier to call directly from JIT to JIT (returning that match start/end in registers, I was also looking at making JIT compilation of the regexps lazy & automatic via a default JIT code function pointer, but I don't think I finished this), which is a route we could pursue if this is the case. cheers, G. On Jun 12, 2012, at 8:42 PM, Zoltan Herczeg wrote:
Hi,
I compared the following two in JSC and in v8:
A: result = str.match(regex);
B: while (regex.exec(str)) ++count;
str was about 20M input, and regex was /./gm
JSC: A: 618 ms B: 3469 ms
V8: A: 2640 ms B: 1833 ms
I was quite surprised that although the result is a really huge array, str.match was much faster in JSC. Is there a known reason to that? Can B be improved in JSC?
Regards, Zoltan
_______________________________________________ squirrelfish-dev mailing list squirrelfish-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/squirrelfish-dev
participants (2)
-
Gavin Barraclough
-
Zoltan Herczeg