From da4de2603dd5263108ede6d213a0bb157cef5c57 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Fri, 21 Dec 2018 12:03:39 +0100 Subject: [PATCH] perf: use fast-write-atomic instead of write-file-atomic fast-write-atomic is 10-20% faster depending on the operating system, mainly because it does not use fs.realpath() and so many promises. --- package.json | 4 ++-- src/index.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index b8bc3a2..ce1224f 100644 --- a/package.json +++ b/package.json @@ -36,12 +36,12 @@ "dependencies": { "async": "^2.6.1", "datastore-core": "~0.6.0", + "fast-write-atomic": "~0.2.0", "glob": "^7.1.3", "graceful-fs": "^4.1.11", "interface-datastore": "~0.6.0", "mkdirp": "~0.5.1", - "pull-stream": "^3.6.9", - "write-file-atomic": "^2.3.0" + "pull-stream": "^3.6.9" }, "devDependencies": { "aegir": "^15.3.1", diff --git a/src/index.js b/src/index.js index 6fd15c1..d5b1826 100644 --- a/src/index.js +++ b/src/index.js @@ -10,7 +10,7 @@ const setImmediate = require('async/setImmediate') const waterfall = require('async/series') const each = require('async/each') const mkdirp = require('mkdirp') -const writeFile = require('write-file-atomic') +const writeFile = require('fast-write-atomic') const path = require('path') const asyncFilter = require('interface-datastore').utils.asyncFilter