Skip to content

Commit ff3717a

Browse files
committed
perf: the file mapping cache was off by mistake. #1527
1 parent d00f1dd commit ff3717a

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

CHANGES.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ development at the same time, such as 4.5.x and 5.0.
2020
Unreleased
2121
----------
2222

23-
Nothing yet.
23+
- Performance: an internal cache of file names was accidentally disabled,
24+
resulting in sometimes drastic reductions in performance. This is now fixed,
25+
closing `issue 1527`_. Thanks to Ivan Ciuvalschii for the reproducible test
26+
case.
27+
28+
.. _issue 1527: https://github.com/nedbat/coveragepy/issues/1527
2429

2530

2631
.. _changes_7-0-3:

CONTRIBUTORS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ Hugo van Kemenade
8181
Ilia Meerovich
8282
Imri Goldberg
8383
Ionel Cristian Mărieș
84+
Ivan Ciuvalschii
8485
J. M. F. Tsang
8586
JT Olds
8687
Jerin Peter George

coverage/collector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ def disable_plugin(self, disposition: TFileDisposition) -> None:
433433
plugin._coverage_enabled = False
434434
disposition.trace = False
435435

436-
@functools.lru_cache(maxsize=0)
436+
@functools.lru_cache(maxsize=None)
437437
def cached_mapped_file(self, filename: str) -> str:
438438
"""A locally cached version of file names mapped through file_mapper."""
439439
return self.file_mapper(filename)

0 commit comments

Comments
 (0)