Skip to content

Commit 6b0cac5

Browse files
committed
perf: cache _human_key to speed html report by about 10%
1 parent fdc0ee8 commit 6b0cac5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

coverage/misc.py

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import contextlib
99
import datetime
1010
import errno
11+
import functools
1112
import hashlib
1213
import importlib
1314
import importlib.util
@@ -313,6 +314,7 @@ def import_local_file(modname: str, modfile: str | None = None) -> ModuleType:
313314
return mod
314315

315316

317+
@functools.lru_cache(maxsize=None)
316318
def _human_key(s: str) -> tuple[list[str | int], str]:
317319
"""Turn a string into a list of string and number chunks.
318320

0 commit comments

Comments
 (0)