function(window|function(window, undefined)的意义
var num = 10000 for (var i = 0; i++; i < num) { eval("pp" + i + "=" + i); }(function(window, undefined){ var a1 = new Date(); for (var i = 0; i < num; i++) { document.write(window["pp" + i]); } var a2 = new Date(); alert(a2.getTime() - a1.getTime()); })(window); (function(undefined){ var a1 = new Date(); for (var i = 0; i < num; i++) { document.write(window["pp" + i]); } var a2 = new Date(); alert(a2.getTime() - a1.getTime()); })();
速度提升2/3
【function(window|function(window, undefined)的意义】来自:http://blog.csdn.net/qq1119753812/article/details/6820697
PS:在一间屋子里找一个杯子,和在茶几上找一个杯子;
推荐阅读
- 列出所有自定义的function和view
- 一个选择排序算法
- Caffe在Windows10下CPU版本的安装(cpu+anaconda3+vs2013+pycaffe)
- 笔记|如何在Windows11安装安卓子系统()
- windows11|Windows11安装Android子系统
- 函数的一些东西
- 由Uncaught|由Uncaught TypeError: this.player.startMoveAt is not a function引申
- Windows10|Windows10,Version,1903,7月更新,MSDN镜像下载
- arrow|arrow function
- Windows必备良心软件,让电脑更酷更高效率!