diff options
Diffstat (limited to 'date-fns/src/min/benchmark.js')
-rw-r--r-- | date-fns/src/min/benchmark.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/date-fns/src/min/benchmark.js b/date-fns/src/min/benchmark.js new file mode 100644 index 0000000..e2a997b --- /dev/null +++ b/date-fns/src/min/benchmark.js @@ -0,0 +1,27 @@ +// @flow +/* eslint-env mocha */ +/* global suite, benchmark */ + +import min from '.' +import moment from 'moment' + +suite( + 'min', + function() { + benchmark('date-fns', function() { + return min([this.dateA, this.dateB]) + }) + + benchmark('Moment.js', function() { + return moment.min(this.momentA, this.momentB) + }) + }, + { + setup: function() { + this.dateA = new Date() + this.momentA = moment() + this.dateB = new Date(this.dateA.getTime() + 604800000) + this.momentB = this.momentA.clone().add(7, 'days') + } + } +) |