compute regex vs substr
JavaScript performance comparison
Info
http://stackoverflow.com/questions/11818896/how-do-i-make-an-anchored-regex-match-in-the-middle-of-a-string-in-javascript
Preparation code
<script>
Benchmark.prototype.setup = function() {
var target = "foobar barse";
var str_match = "bar";
var pre_regex = /^bar/;
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
compute |
|
pending… |
substr+pre |
|
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 Bergi
- Revision 7: published
- Revision 8: published by asmblah
0 comments