Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
eval vs new Function vs function(Sample JS Functions) 2
(version: 1)
Comparing performance of:
eval vs new Function vs regular
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
var newFunc = new Function("let r = Math.random().toString(36).substring(7).includes('x');"); var regular = function(){ let r = Math.random().toString(36).substring(7).includes('x');; }
Tests:
eval
eval("let r = Math.random().toString(36).substring(7).includes('x');");
new Function
newFunc();
regular
regular()
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
eval
new Function
regular
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Browser/OS:
Chrome 134 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
eval
3811502.0 Ops/sec
new Function
5454155.5 Ops/sec
regular
5533500.0 Ops/sec
Related benchmarks:
eval vs new Function (Sample JS Functions)
eval vs new Function vs function (Sample JS Functions)
eval vs new Function vs function(Sample JS Functions)
new function vs eval vs regular functions
eval vs new Function (Sample JS Functions)2
new Function vs function(Sample JS Functions)
Function Instantiation
new Function vs function
eval vs new Function vs function(Sample JS Functions)2
Comments
Confirm delete:
Do you really want to delete benchmark?