array sort perform
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
var arr = [],
arr2 = [],
arr3 = [],
arrLen = 1000,
i = 0;
function makeWord(){
var word = [],
words = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'],
wordsLength = words.length,
arrMinLen = 3,
arrLen = arrMinLen + Math.floor( Math.random()*9 ),
i = 0;
for (i = 0; i < arrLen; i++){
word.push( words[Math.floor( Math.random()*wordsLength )] );
}
return word.join('');
}
// ä¸‰ä¸ªä¸€æ¨¡ä¸€æ ·çš„æ•°ç»„
for (i = 0; i < arrLen; i++) {
arr.push( makeWord() );
arr2.push( makeWord() );
arr3.push( makeWord() );
}
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
Test | Ops/sec | |
---|---|---|
未优化
|
|
pending… |
map优化
|
|
pending… |
䏿”¯æŒmap的时候的兼容方法
|
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit
to the URL.
0 Comments