From 1a3ae4e117b415ff74b7f90f2e96cecbfdaff6f2 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Mon, 3 Oct 2016 21:01:01 -0400 Subject: [PATCH] Remove _statCache and _pkgJsonCache members from Resolver. This caching is redundant now that we're using optimistic functions for accessing the file system in Resolver methods. --- tools/isobuild/resolver.js | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/tools/isobuild/resolver.js b/tools/isobuild/resolver.js index e33aed2499..ef31b7da2a 100644 --- a/tools/isobuild/resolver.js +++ b/tools/isobuild/resolver.js @@ -63,8 +63,6 @@ export default class Resolver { this.statOrNull = statOrNull; this._resolveCache = new Map; - this._statCache = new Map; - this._pkgJsonCache = new Map; } static isTopLevel(id) { @@ -138,10 +136,6 @@ export default class Resolver { _joinAndStat(...joinArgs) { const joined = pathJoin(...joinArgs); - if (this._statCache.has(joined)) { - return this._statCache.get(joined); - } - const path = pathNormalize(joined); const exactStat = this.statOrNull(path); const exactResult = exactStat && { path, stat: exactStat }; @@ -166,7 +160,6 @@ export default class Resolver { result = exactResult; } - this._statCache.set(joined, result); return result; } @@ -258,15 +251,8 @@ export default class Resolver { } _readPkgJson(path) { - if (this._pkgJsonCache.has(path)) { - return this._pkgJsonCache.get(path); - } - - let result = null; try { - const contents = optimisticReadFile(path); - result = JSON.parse(contents); - this.watchSet.addFile(path, sha1(contents)); + return JSON.parse(optimisticReadFile(path)); } catch (e) { if (! (e instanceof SyntaxError || e.code === "ENOENT")) { @@ -274,8 +260,7 @@ export default class Resolver { } } - this._pkgJsonCache.set(path, result); - return result; + return null; } _resolvePkgJsonMain(dirPath, _seenDirPaths) {