bench.js 462 B

123456789101112131415161718192021222324252627
  1. 'use strict'
  2. var split = require('./')
  3. var bench = require('fastbench')
  4. var binarySplit = require('binary-split')
  5. var fs = require('fs')
  6. function benchSplit (cb) {
  7. fs.createReadStream('package.json')
  8. .pipe(split())
  9. .on('end', cb)
  10. .resume()
  11. }
  12. function benchBinarySplit (cb) {
  13. fs.createReadStream('package.json')
  14. .pipe(binarySplit())
  15. .on('end', cb)
  16. .resume()
  17. }
  18. var run = bench([
  19. benchSplit,
  20. benchBinarySplit
  21. ], 10000)
  22. run(run)