jQueryセレクタAPIのベンチマーク kyo_ago Follow 2011-12-01 12:07:37 License: MIT License Fork5 Fav12 View15279 Play Stop Reload Fullscreen Smart Phone Fork tree Readme JavaScript 54 lines HTML 1 lines CSS 1 lines jQueryセレクタAPIのベンチマーク jQuery v1.7.1 var div_id = (function () { var time = +(Date.now ? Date.now() : new Date()); var count = 1000; var tmp = 0; while (count--) { var hoge = $('div#hoge'); tmp += hoge.length; }; tmp = 0; return +(Date.now ? Date.now() : new Date()) - time + tmp; })(); var _id = (function () { var time = +(Date.now ? Date.now() : new Date()); var count = 1000; var tmp = 0; while (count--) { var hoge = $('#hoge'); tmp += hoge.length; }; tmp = 0; return +(Date.now ? Date.now() : new Date()) - time + tmp; })(); var div_class = (function () { var time = +(Date.now ? Date.now() : new Date()); var count = 1000; var tmp = 0; while (count--) { var hoge = $('div.huga'); tmp += hoge.length; }; tmp = 0; return +(Date.now ? Date.now() : new Date()) - time + tmp; })(); var _class = (function () { var time = +(Date.now ? Date.now() : new Date()); var count = 1000; var tmp = 0; while (count--) { var hoge = $('.huga'); tmp += hoge.length; }; tmp = 0; return +(Date.now ? Date.now() : new Date()) - time + tmp; })(); document.write('<div>' + [ "$('div#hoge') * 1000 = " + div_id + "ms", "$('#hoge') * 1000 = " + _id + "ms", "$('div.hoge') * 1000 = " + div_class + "ms", "$('.hoge') * 1000 = " + _class + "ms" ].join('<br>')+'</div>'); <div id="hoge" class="huga"></div> jQueryセレクタAPIのベンチマーク body { background-color: #DDDDDD; font: 30px sans-serif; } var div_id = (function () { var time = +(Date.now ? Date.now() : new Date()); var count = 1000; var tmp = 0; while (count--) { var hoge = $('div#hoge'); tmp += hoge.length; }; tmp = 0; return +(Date.now ? Date.now() : new Date()) - time + tmp; })(); var _id = (function () { var time = +(Date.now ? Date.now() : new Date()); var count = 1000; var tmp = 0; while (count--) { var hoge = $('#hoge'); tmp += hoge.length; }; tmp = 0; return +(Date.now ? Date.now() : new Date()) - time + tmp; })(); var div_class = (function () { var time = +(Date.now ? Date.now() : new Date()); var count = 1000; var tmp = 0; while (count--) { var hoge = $('div.huga'); tmp += hoge.length; }; tmp = 0; return +(Date.now ? Date.now() : new Date()) - time + tmp; })(); var _class = (function () { var time = +(Date.now ? Date.now() : new Date()); var count = 1000; var tmp = 0; while (count--) { var hoge = $('.huga'); tmp += hoge.length; }; tmp = 0; return +(Date.now ? Date.now() : new Date()) - time + tmp; })(); document.write('<div>' + [ "$('div#hoge') * 1000 = " + div_id + "ms", "$('#hoge') * 1000 = " + _id + "ms", "$('div.hoge') * 1000 = " + div_class + "ms", "$('.hoge') * 1000 = " + _class + "ms" ].join('<br>')+'</div>'); <div id="hoge" class="huga"></div> body { background-color: #DDDDDD; font: 30px sans-serif; } use an iframe compat browser, deer Play on jsdo.it games Share Embed QR Tag Download Complete! Description どんなゲームですか? Control Device スマートフォンコントローラー jsdo.it WebSocket Controller» マウス キーボード タッチデバイス Fullscreen 有効 無効 jsdo.it games から削除する Submit http://jsdo.it/kyo_ago/oTns jQueryセレクタAPIのベンチマーク Tweet style Design view Code view code <script type="text/javascript" src="http://jsdo.it/blogparts/oTns/js?view=design"></script><p class="ttlBpJsdoit" style="width: 465px; margin: 0; text-align: right; font-size: 11px;"><a href="http://jsdo.it/kyo_ago/oTns" title="jQueryセレクタAPIのベンチマーク">jQueryセレクタAPIのベンチマーク - jsdo.it - share JavaScript, HTML5 and CSS</a></p> Tweet twitter Tags jQuery library&test performance ベンチマーク Favorite by dentaq geta yostoki kleinschmidt.. koichironish.. demouth calmbooks zahir1929: ベンチマークjQuery imaya: jQuery tokkonopapa: performance daisuke: jQuery esperia: jQueryperformance Forked sort new page view favorite forked forked: jQueryセレクタAPIのベンチマーク downtheline1.. 00 45views 55/1/1 forked: jQueryセレクタAPIのベンチマーク studiomalia1.. 00 52views 55/1/1 forked: jQueryセレクタAPIのベンチマーク zahir1929 00 65views 68/1/1 forked: jQueryセレクタAPIのベンチマーク geta 00 55views 55/1/1 1 2 3 4NEXT>>