クロージャ, call, apply の今
もう1年も経っていた。
http://d.hatena.ne.jp/arikui/20091021
久々に気になったのでちょっと直して測りなおしました。計測PCも違ってたりしますが、多分傾向は同じ。
単位はナノ秒。
fx3.6
plain 57 closure 218 call 230 apply 520 apply arguments 1700 apply this value 262 closure 3 nest 516 call 3 nest 518
クロージャもcallも大して差がなくなった。argumentsをapplyすると一気に遅い。
fx4b8
plain 13 closure 114 call 137 apply 211 apply arguments 322 apply this value 107 closure 3 nest 395 call 3 nest 360
argumentsのapplyが速くなった。コンテキスト辿るのも速くなった感じがする。
ie9b
plain 410 closure 2443 call 1733 apply 2043 apply arguments 4427 apply this value 1867 closure 3 nest 3886 call 3 nest 4143
クロージャが遅いみたいだけど、callを重ねると大差なくなる。
opera10.7
plain 35 closure 523 call 558 apply 195 apply arguments 1135 apply this value 672 closure 3 nest 1583 call 3 nest 1835
配列のapplyが何故か速い。
safari5
plain 44 closure 960 call 993 apply 962 apply arguments 1131 apply this value 1060 closure 3 nest 2829 call 3 nest 2881
平均的。
chrome 9
plain 24 closure 79 call 266 apply 120 apply arguments 285 apply this value 286 closure 3 nest 131 call 3 nest 713
callがやけに遅い。