MomentJS parse vs strftime
JavaScript performance comparison
Preparation code
<script src="https://raw.github.com/timrwood/moment/1.3.0/moment.js"></script>
<script src="http://cloud.github.com/downloads/benjaminoakes/moment-strftime/moment-strftime.js"></script>
<script>
var a = moment();
if (window.console && window.console.log) {
console.log('moment.fn.strftime : ' + a.strftime("%m/%d/%y %I:%M %p %Z"));
console.log('moment.fn.format : ' + a.format('MM/DD/YY HH:mm A z'));
}
</script>
<script>
Benchmark.prototype.setup = function() {
var a = moment();
};
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
strftime |
|
pending… |
format |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments