[Webkit-unassigned] [Bug 103727] New: Unset NodeMustGenerate flag for Call nodes of few String.prototype.* pure functions
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Nov 30 02:45:21 PST 2012
https://bugs.webkit.org/show_bug.cgi?id=103727
Summary: Unset NodeMustGenerate flag for Call nodes of few
String.prototype.* pure functions
Product: WebKit
Version: 528+ (Nightly build)
Platform: All
OS/Version: All
Status: UNCONFIRMED
Severity: Normal
Priority: P2
Component: JavaScriptCore
AssignedTo: webkit-unassigned at lists.webkit.org
ReportedBy: dm at ispras.ru
Function calls have NodeMustGenerate flag set, but this is redundant in case the function has no side effects. This patch aims to remove NodeMustGenerate flag for Call nodes of String.replace, String.split, and String.indexOf, if their argument types imply no side effects. This would allow to eliminate such calls, if their result is unused.
Example:
function foo() {
var str = "split it up";
var i;
for (i = 0; i < 10000; i++) {
var x = str.split(" ");
}
}
var i;
for (i = 0; i < 1000; i++)
foo();
Run time w/o patch: 1.756s
With the patch: 0.032s
Is it, in general, the right way to eliminate redundant calls?
I admit that using strcmp is not the best way to check for function names -- probably it would be better to create a hashtable with mapping of function names to argument checking routines, but for now I just would like to get some feedback to know whether this optimization is correct and if the WebKit community is interested in it.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list