authorjQuery, Sizzle, querySelectorAll, XPathの速度検証 単に要素を取得したいだけの場合、いったいどれが一番速いのか。 function bench (func) { var start = (new Date()).getTime(); for (var i = 0; i < 1000000; i++) { func(); } var end = (new Date()).getTime(); console.log((end - start) + 'ms'); } ベンチコードは右記のようなもの つまるところ、100万回取得する。 それを5回試行して、平均値を取ったものをスコアとする。 ID $('#id') jQuery 2s Sizzle('#id') Sizzle 2.4s document.querySelectorAll('#par