summaryrefslogtreecommitdiff
path: root/date-fns/src/sub/benchmark.js
diff options
context:
space:
mode:
Diffstat (limited to 'date-fns/src/sub/benchmark.js')
-rw-r--r--date-fns/src/sub/benchmark.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/date-fns/src/sub/benchmark.js b/date-fns/src/sub/benchmark.js
new file mode 100644
index 0000000..8b96341
--- /dev/null
+++ b/date-fns/src/sub/benchmark.js
@@ -0,0 +1,25 @@
+// @flow
+/* eslint-env mocha */
+/* global suite, benchmark */
+
+import sub from '.'
+import moment from 'moment'
+
+suite(
+ 'add',
+ function() {
+ benchmark('date-fns', function() {
+ return sub(this.date, { hours: 5, minutes: 10 })
+ })
+
+ benchmark('Moment.js', function() {
+ return this.moment.subtract({ hours: 5, minutes: 10 })
+ })
+ },
+ {
+ setup: function() {
+ this.date = new Date()
+ this.moment = moment()
+ }
+ }
+)