Skip to content

Commit 284677e

Browse files
authored
Use sha1 for hashing (#17953)
This is a pretty small win, it's below the noise floor on macrobenchmark, but if you time the hashing specifically it saves about 100ms (0.5%) on `python -m mypy -c 'import torch' --no-incremental`. blake2b is slower
1 parent 676ed06 commit 284677e

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

mypy/util.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -534,9 +534,7 @@ def hash_digest(data: bytes) -> str:
534534
accidental collision, but we don't really care about any of the
535535
cryptographic properties.
536536
"""
537-
# Once we drop Python 3.5 support, we should consider using
538-
# blake2b, which is faster.
539-
return hashlib.sha256(data).hexdigest()
537+
return hashlib.sha1(data).hexdigest()
540538

541539

542540
def parse_gray_color(cup: bytes) -> str:

0 commit comments

Comments
 (0)