Skip to content

Commit

Permalink
perf: cache _human_key to speed html report by about 10%
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed May 3, 2024
1 parent fdc0ee8 commit 6b0cac5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions coverage/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import contextlib
import datetime
import errno
import functools
import hashlib
import importlib
import importlib.util
Expand Down Expand Up @@ -313,6 +314,7 @@ def import_local_file(modname: str, modfile: str | None = None) -> ModuleType:
return mod


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

0 comments on commit 6b0cac5

Please sign in to comment.