hex check: parseInt vs regex
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
var validStr = '5daabfd355de86f925d6e716e9a41c570324b066922c23bf4bacbc857827c4c1'
var invalidStr = '5daabfd355de86f925d6e716e9a41c570324b066922c23bf4bacbc857827c4cX'
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
parseInt - valid |
|
pending… |
parseInt - invalid |
|
pending… |
regex - valid |
|
pending… |
regex - invalid |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments