From d1e48f428a134890de0e285eec14ac2a7103cd10 Mon Sep 17 00:00:00 2001 From: Shantanu Date: Mon, 26 Oct 2026 06:39:45 +0000 Subject: [PATCH] Drop the duplicate SQLite cache path index The UNIQUE constraint on files2.path creates an index on that column. The explicit path_idx indexed the same keys, so every cold-cache insert updated two indexes. Existing databases keep their index and old mypy versions can read the new layout. This reduced cold torch 2.1.0 import wall time by 1.22% (3.263 s to 3.226 s, 95% interval 1.00% to 1.44%). Self-check fell by 0.43% (6.198 s to 6.171 s, interval 0.20% to 0.68%). These were 16 alternating pairs per input against the parent commit, using compiled mypy on CPython 3.11.8 with a fresh cache and no workers. All diagnostic streams matched. The torch improvement also replicated against the unmodified fork at 1.25% across 14 pairs. Eight pairs per primer input showed 1.62% on pandas, 1.33% on colour, and 0.88% on jax. The first zulip series was noisy. An independent 16-pair series measured 0.78% (interval 0.50% to 1.02%). The 16 torch shard files occupied 15,847,424 bytes, down from 16,080,896. Both caches contained 3,061 rows. All 1,020 module data blobs were byte-identical. Each version reused the other's cache and SQLite's integrity checks passed in both directions. The cache diff and fine-grained cache suites passed (552 tests). --- mypy/metastore.py | 1 - 1 file changed, 1 deletion(-) diff --git a/mypy/metastore.py b/mypy/metastore.py index c48ac78bdcb72..c1dbc344d5c5d 100644 --- a/mypy/metastore.py +++ b/mypy/metastore.py @@ -158,7 +158,6 @@ def close(self) -> None: mtime REAL, data BLOB ); -CREATE INDEX IF NOT EXISTS path_idx on files2(path); """