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