toISODateString
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
var method1 = function () { return this.toISOString().slice(0, 10); };
var method2 = function () {
return this.getFullYear() + '-' + (this.getMonth() + 1) + '-' + this.getDate();
};
var date = new Date();
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Slice ISOString |
|
pending… |
Build string |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments