Chrome 39 JavaScript Performance Anomaly

I did a jsPerf test to find out if there are differences in performance between using arguments or local variables in a function in JavaScript.

There were virtually no differences in Firefox 34. However, in Chrome 39, the compiler seems to do a lot of damage. See the following results:

Can anyone explain why this is happening?

+4
source share
1 answer

, , , - , literal, for-in. , . .

, , , V8 , : FastNewClosureStub, , [1]. - , , ( ).

"" [2] , . : : , , .

, , () . , , with, eval arguments - , .

[1] https://github.com/v8/v8-git-mirror/blob/9def087efcd844342c35f42628bac4ead49cac81/src/ia32/full-codegen-ia32.cc#L1213-L1218

[2] http://jsperf.com/variable-vs-variable-passed-as-an-argument-to-a-self-in/3

+4

Source: https://habr.com/ru/post/1570015/


All Articles