regex loop-for vs loop-while
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
var specialChars = [{
val: "a",
let: "áàãâä"
}, {
val: "e",
let: "éèêë"
}, {
val: "i",
let: "íìîï"
}, {
val: "o",
let: "óòõôö"
}, {
val: "u",
let: "úùûü"
}, {
val: "c",
let: "ç"
}, {
val: "A",
let: "ÁÀÃÂÄ"
}, {
val: "E",
let: "ÉÈÊË"
}, {
val: "I",
let: "ÍÌÎÏ"
}, {
val: "O",
let: "ÓÒÕÔÖ"
}, {
val: "U",
let: "ÚÙÛÜ"
}, {
val: "C",
let: "Ç"
}, {
val: "",
let: "^a-zA-Z0-9"
}];
var str = "SDA&S¨*D&¨%S&DAHSDsdlpfisd09f8-adf[sf]df~]]ç~ç´p8077";
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
for |
|
pending… |
while |
|
pending… |
while #2 |
|
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
- Revision 2: published
- Revision 3: published
0 comments