Forum Discussion

ahmednuaman's avatar
13 years ago

Performance of function expressions vs statements

Are there any performance gains/losses in using function expressions vs statements? In JS there's recently been a push towards using statements as it avoids hoisting and makes the code more semantic, eg not executing a function before it's declared. There's also a handy perf test: http://jsperf.com/fn-expression-vs-statement but the performance difference on modern browser isn't much.

How about on Roku boxes? Is it more performant to use:

sub Main()
print "I can haz app"
end


Or

Main = function()
print "I can haz app"
end


Otherwise are there any benchmark tools available to allow me to performance test these boxes?
No RepliesBe the first to reply