Closed dgreensp closed 8 years ago
The thing is, in babel-compiler, we already have a hash of the source from inputFile.getSourceHash()
.
With PR https://github.com/meteor/babel/pull/9, we could pass this as one of the deps
and use it as a preference if it exists, without breaking backwards compatibility.
Happy to do this as a PR when we get to discussing this.
i.e.
var cacheHash;
if (deps && deps.sourceHash)
cacheHash = sha1(JSON.stringify({meteorBabelVersion, options, deps});
else
cacheHash = util.deepHash(meteorBabelVersion, source, options, deps);
(or simply avoid passing source
to deepHash()
if it's already provided via deps
, which is what I ultimately did in PR #11).
Changing this line to:
...more than doubles hashing performance. The simplest and most performant thing would probably be to drop
deepHash
and just take the SHA ofJSON.stringify({meteorBabelVersion, source, options})
.Edit: Oops, since
source
is a really big string, maybe don't JSON the whole thing, justoptions
, and usedeepHash
.