accessing the arguments object is expensive.. huh?

后端 未结 2 607
失恋的感觉
失恋的感觉 2021-02-08 13:04

I\'ve heard alot of people saying that accessing the arguments object is expensive. (example: Why was the arguments.callee.caller property deprecated in JavaScript?)

Btw

2条回答
  •  余生分开走
    2021-02-08 13:35

    I have also never heard a serious explanation for why accessing the arguments object is expensive. However, this site: http://www.playmycode.com/blog/2011/03/simple-yet-effective-javascript-optimisations/ notes that arguments is not really an array and is less efficient than accessing an array. The above linked site even suggests converting arguments to an array as an optimization.

    Going to check with those who know JS interpreters more intimately...

提交回复
热议问题