Why are .call and .apply slower than a direct function call in JavaScript?

前端 未结 1 1811
感情败类
感情败类 2020-12-25 13:45

I\'m curious about these jsperf results. They appear to demonstrate that a direct function call is substantially faster than the same function called with .call

1条回答
  •  孤独总比滥情好
    2020-12-25 14:26

    I guess the cause might depend on which interpreter your are running the code on, but it seems that normal functions calls are faster because the interpreter can use Inline Cache to access the properties.

    You can have a look here for more information.

    0 讨论(0)
提交回复
热议问题