Bug 24967

Summary: new Function is substantially slower than V8
Product: WebKit Reporter: Oliver Hunt <oliver>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: barraclough, ggaren, sam, zwarich
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
URL: http://weblogs.asp.net/yuanjian/archive/2009/03/22/json-performance-comparison-of-eval-new-function-and-json.aspx

Description Oliver Hunt 2009-03-31 15:35:18 PDT
The linked site shows that performance of eval and new Function are dramatically slower (in the order of 2x slower) than eval and new Function in other browsers.  We should investigate why this is the case.
Comment 1 Oliver Hunt 2009-09-30 16:05:57 PDT
new Function (at least) results in a double parse -- eg.
new Function(string)

is considered

function /*foo*/ (..) {
   string
}

which parses the function statement, but does not generate an AST for `string` as it is inside the function statement
Comment 2 Sam Weinig 2009-09-30 16:08:16 PDT
We could eagerly build the function, but we need to weigh the costs and benefits of doing so.
Comment 3 Gavin Barraclough 2012-09-07 12:46:32 PDT
Retested JSC performance for eval/new Function is 67/389, V8 performance is 82/84, Firefox performance is 71/456.

We're faster than firefox, and only slower now on new Function.  Updating title accordingly.