From: Brian Wyant Date: Mon, 6 Apr 2015 13:35:15 +0000 (-0400) Subject: perf: benchmark moment(Date) ctors X-Git-Tag: 2.10.3~24^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e8a40716f459040fff65103777c330740d35e2d;p=thirdparty%2Fmoment.git perf: benchmark moment(Date) ctors --- diff --git a/benchmarks/fromDate.js b/benchmarks/fromDate.js new file mode 100644 index 000000000..b49f407f8 --- /dev/null +++ b/benchmarks/fromDate.js @@ -0,0 +1,12 @@ +var Benchmark = require('benchmark'), + moment = require('./../moment.js'), + base = new Date(); + +module.exports = { + name: 'fromDate', + onComplete: function(){console.log('done');}, + fn: function(){ + moment(base); + }, + async: true +}; diff --git a/benchmarks/fromDateUtc.js b/benchmarks/fromDateUtc.js new file mode 100644 index 000000000..bdfff1cea --- /dev/null +++ b/benchmarks/fromDateUtc.js @@ -0,0 +1,12 @@ +var Benchmark = require('benchmark'), + moment = require('./../moment.js'), + base = new Date(); + +module.exports = { + name: 'fromDateUtc', + onComplete: function(){console.log('done');}, + fn: function(){ + moment.utc(base); + }, + async: true +};