From 159974cc59de459cfb3e31ba3e1d8f279734f66d Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Tue, 15 Oct 2024 01:48:34 -0700 Subject: [PATCH] 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 --- mypy/util.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mypy/util.py b/mypy/util.py index 4b1b918b92e6..75b3e9101731 100644 --- a/mypy/util.py +++ b/mypy/util.py @@ -535,9 +535,7 @@ def hash_digest(data: bytes) -> str: accidental collision, but we don't really care about any of the cryptographic properties. """ - # Once we drop Python 3.5 support, we should consider using - # blake2b, which is faster. - return hashlib.sha256(data).hexdigest() + return hashlib.sha1(data).hexdigest() def parse_gray_color(cup: bytes) -> str: