]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
perf: benchmark moment(Date) ctors
authorBrian Wyant <brian.wyant@oracle.com>
Mon, 6 Apr 2015 13:35:15 +0000 (09:35 -0400)
committerIskren Chernev <iskren.chernev@gmail.com>
Mon, 4 May 2015 04:14:11 +0000 (21:14 -0700)
benchmarks/fromDate.js [new file with mode: 0644]
benchmarks/fromDateUtc.js [new file with mode: 0644]

diff --git a/benchmarks/fromDate.js b/benchmarks/fromDate.js
new file mode 100644 (file)
index 0000000..b49f407
--- /dev/null
@@ -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 (file)
index 0000000..bdfff1c
--- /dev/null
@@ -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
+};