~indexof-1
JavaScript performance comparison
Preparation code
<script>var testArray=[],testSearch=[];
for(var i = 0;i<10000;i++){
testArray.push(Math.ceil(Math.random()*10000));
}
for(var i = 0;i<1000;i++){
testSearch.push(testArray[Math.floor(Math.random()*10000)]);
}
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
indexOf > -1 |
|
pending… |
~indexOf |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments