Skip to content
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

Remove inference tip cache #1832

Closed
wants to merge 1 commit into from
Closed

Remove inference tip cache #1832

wants to merge 1 commit into from

Conversation

kriek
Copy link
Contributor

@kriek kriek commented Oct 13, 2022

ChangeLog

Fixed type inconsistently inferred for base methods returning type(self).

Description

Remove inference tip cache. It misses the context to properly evaluate a base class method returned type when the returned type depends on the subclass instance calling the method.

Type of Changes

Type
βœ“ πŸ› Bug fix

Related Issue

Closes #1828

@coveralls
Copy link

Pull Request Test Coverage Report for Build 3245692888

  • 6 of 6 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.009%) to 92.288%

Totals Coverage Status
Change from base Build 3245635291: -0.009%
Covered Lines: 9848
Relevant Lines: 10671

πŸ’› - Coveralls

@cdce8p
Copy link
Member

cdce8p commented Oct 14, 2022

I'm not sure this is the right call. It looks like we don't fully understand the consequences of removing the cache yet.
While testing with Home Assistant, I'm seeing a noticeable performance impact (from 7min previously to 8-10min) and a new false-positive.

@DanielNoord
Copy link
Collaborator

I was going to ask you for a test on home-assistant. Thanks for already doing so.

That does indeed seem like this serves a purpose!

@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.12.12 milestone Oct 17, 2022
@kriek
Copy link
Contributor Author

kriek commented Oct 17, 2022

I'm not sure this is the right call. It looks like we don't fully understand the consequences of removing the cache yet. While testing with Home Assistant, I'm seeing a noticeable performance impact (from 7min previously to 8-10min) and a new false-positive.

Would you mind sharing the false-positive location? I'd like to dig that a bit.
I'm also having a look at the performance impact but my Windows machine seems not very suited for the home-assistant pylint evaluation and for now, I'm fighting to get the pip requirements installed.

@Pierre-Sassoulas Pierre-Sassoulas removed this from the 2.12.12 milestone Oct 18, 2022
@Pierre-Sassoulas
Copy link
Member

Regarding the performance impact, it's expected that removing the cache would lower performance. Slightly lower perfs are acceptable if we fix a bug that happen often, but +10% is not slight. We'd need to replace the buggy cache by a working cache. What was the false positive in home-assistant @cdce8p ?

@kriek
Copy link
Contributor Author

kriek commented Oct 24, 2022

I'm not able to see the false positive on my side. On my slow machine, the home-assistant penalty is +15% (from 28 to 32 min ; with --jobs=1). Indeed not slight.

@cdce8p
Copy link
Member

cdce8p commented Oct 24, 2022

What was the false positive in home-assistant @cdce8p ?

Haven't had time to double check. Hopefully tomorrow.

@cdce8p
Copy link
Member

cdce8p commented Oct 25, 2022

Would you mind sharing the false-positive location? I'd like to dig that a bit.

homeassistant/components/hive/__init__.py:92:8: E0705: Exception cause set to something which is not an exception, nor None (bad-exception-cause)

https://github.com/home-assistant/core/blob/beeee8b60eaa2415add69cd0b385dec56182a407/homeassistant/components/hive/__init__.py#L90-L92

pylint -j 1 homeassistant/components/hive/__init__.py 

This seems to be enough to reproduce it.

I'm also having a look at the performance impact but my Windows machine seems not very suited for the home-assistant pylint evaluation and for now, I'm fighting to get the pip requirements installed.

I've given up on running it locally a long time ago πŸ˜… My laptop just isn't powerful enough.
My performance numbers where from Github action runs which is probably a bit inaccurate.

I'm not able to see the false positive on my side. On my slow machine, the home-assistant penalty is +15% (from 28 to 32 min ; with --jobs=1). Indeed not slight.

+15% roughly matches what I've seen. IMO that's quite a lot so I'm really not sure it's worth it to remove the whole cache.
I haven't followed the discussion around the issue. Ideally we would find why caching doesn't work properly and fix it instead of removing it.

@cdce8p cdce8p marked this pull request as draft November 13, 2022 10:54
@cdce8p cdce8p added the High effort πŸ‹ Difficult solution or problem to solve label Nov 13, 2022
@jacobtylerwalls
Copy link
Member

Thanks for the investigation @kriek! Your analysis of the problem is correct. I added your regression test and credited you in #2158, which just fixes the cache key, as suggested by @cdce8p in his last message. Closing this PR as superseded.

@kriek
Copy link
Contributor Author

kriek commented Apr 30, 2023

Thanks for moving forward by tackling the cache key issue @jacobtylerwalls!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug πŸͺ³ High effort πŸ‹ Difficult solution or problem to solve
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong type inferred - inference type cache is missing context
6 participants