According to this benchmark http://jsperf.com/function-vs-function created functions run about 1000 times faster. Can you comment this?
f1
but not f2
. I.e. your second test is doing nothing but looking up a reference.I think what you want is actually this: http://jsperf.com/function-vs-function/2
Update: On second thought, you might not want this. But nevertheless, your second test is doing nothing. You are missing the ()
after f2
;)
So besides new Function
being way slower, it is also harder to maintain the body of the function ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With