Skip to content

move Bestrelpath cache move to session #4314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

RonnyPfannschmidt
Copy link
Member

this removes a perky monkey-patch on configu


self.config.pluginmanager.register(self, name="session")

def _node_location_to_relpath(self, node_path):
# bestrelpath is a quite slow function
return self._bestrelpathcache[node_path]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using lru_cache here?
Or mark is as TODO, since py27 does not use it.
(we could also backport it for py27, of course, if we're starting to use it more/here)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lru cache has a significantly higher complexity - for a full cache (like this one) its overcill ^^
that being said - in a few iterations the cache will be gone for more effective ways

@nicoddemus nicoddemus merged commit 1752c7e into pytest-dev:features Nov 5, 2018
@RonnyPfannschmidt RonnyPfannschmidt deleted the bestrelpath-cache-move-to-session branch November 30, 2018 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants