Skip to content

Commit 159974c

Browse files
committed
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 2416dbf commit 159974c

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
@@ -535,9 +535,7 @@ def hash_digest(data: bytes) -> str:
535535
accidental collision, but we don't really care about any of the
536536
cryptographic properties.
537537
"""
538-
# Once we drop Python 3.5 support, we should consider using
539-
# blake2b, which is faster.
540-
return hashlib.sha256(data).hexdigest()
538+
return hashlib.sha1(data).hexdigest()
541539

542540

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

0 commit comments

Comments
 (0)