jquery,mootools,ext3,prototype对class选择符速度比较

共1296个元素,结果为:

  ie8 ff 平均值 排名
extcore3 20.4 6.31 13.355 1
jquery 25.05 3.79 14.42 2
prototype 81.09 6.93 44.01 3
mootools 77.6 19.1 48.33 4

<script src="firebug/firebug.js" type="text/javascript"></script>

<script src="jquery-1.3.2.js" type="text/javascript"></script> 
<!-- <script src="mootools-1[1].2.1-core-nc.js" type="text/javascript"></script>-->
<!-- <script src="ext-core-debug.js" type="text/javascript"></script>-->
<!-- <script src="prototype.js" type="text/javascript"></script>-->
<script type="text/javascript">
    var icount = 0;
    window.onload = function() {
        var begin = new Date();
        var i = $('.aaa').length;                          //jquery
        //var i = Ext.query('.aaa').length;            //ext
        //var i = $$('.aaa').length;                      //mootools,prototype
        console.log("共" + i + "个,用时共:" + (new Date() - begin));
        if (++icount < 100)
            arguments.callee();
       
    }
</script>

测试文件及结果明细表

原文地址:https://www.cnblogs.com/cola/p/1443704.html