Skip to content

Commit

Permalink
perf: the file mapping cache was off by mistake. #1527
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Jan 7, 2023
1 parent d00f1dd commit b3b05bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ development at the same time, such as 4.5.x and 5.0.
Unreleased
----------

Nothing yet.
- Performance: an internal cache of file names was accidentally disabled,
resulting in sometimes drastic reductions in performance. This is now fixed,
closing `issue 1527`_. Thanks to Ivan Ciuvalschii for the reproducible test
case.

.. _issue 1527: https://github.com/nedbat/coveragepy/issues/1527


.. _changes_7-0-3:
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Hugo van Kemenade
Ilia Meerovich
Imri Goldberg
Ionel Cristian Mărieș
Ivan Ciuvalschii
J. M. F. Tsang
JT Olds
Jerin Peter George
Expand Down
2 changes: 1 addition & 1 deletion coverage/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def disable_plugin(self, disposition: TFileDisposition) -> None:
plugin._coverage_enabled = False
disposition.trace = False

@functools.lru_cache(maxsize=0)
@functools.lru_cache(maxsize=None) # pylint: disable=method-cache-max-size-none
def cached_mapped_file(self, filename: str) -> str:
"""A locally cached version of file names mapped through file_mapper."""
return self.file_mapper(filename)
Expand Down

0 comments on commit b3b05bd

Please sign in to comment.