condition-vs-regex-vs-every-loop-vs-indexOf
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
var a = 1,
b = 2,
c = 3,
d = 4,
e = 5;
function isTrue(vars, vals) {
return vals.every(function(val, i) {
return vars[i] == val
});
}
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
condional |
|
pending… |
every |
|
pending… |
indexOf |
|
pending… |
indexOf (not litteral) |
|
pending… |
RegExp (not litteral) |
|
pending… |
Compare results of other browsers
Revisions
You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:
- Revision 1: published by condition-vs-every-loop
- Revision 2: published
0 comments