Skip to content
This repository was archived by the owner on Feb 4, 2020. It is now read-only.

Commit a5b72cb

Browse files
committed
use md5 (faster) and avoid locking to check cache
1 parent e11044a commit a5b72cb

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

clcache.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,15 @@ def computeKey(self, compilerBinary, commandLine):
138138
normalizedCmdLine = self._normalizedCommandLine(commandLine)
139139

140140
stat = os.stat(compilerBinary)
141-
sha = hashlib.sha1()
142-
sha.update(str(stat.st_mtime))
143-
sha.update(str(stat.st_size))
144-
sha.update(' '.join(normalizedCmdLine))
145-
sha.update(preprocessedSourceCode)
146-
return sha.hexdigest()
141+
h = hashlib.md5()
142+
h.update(str(stat.st_mtime))
143+
h.update(str(stat.st_size))
144+
h.update(' '.join(normalizedCmdLine))
145+
h.update(preprocessedSourceCode)
146+
return h.hexdigest()
147147

148148
def hasEntry(self, key):
149-
with self.lock:
150-
return os.path.exists(self.cachedObjectName(key))
149+
return os.path.exists(self.cachedObjectName(key))
151150

152151
def setEntry(self, key, objectFileName, compilerOutput):
153152
with self.lock:

0 commit comments

Comments
 (0)