-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
PERF: Remove _item_cache #50547
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
Comments
I would be +1 to remove _item_cache. An intermediate option is to use a |
What would the benefit / goal of using
Specifically for this aspect, those columns will normally all be views on the dataframe data, so I don't fully understand how this would blow up memory usage |
By allowing users to set a cache size for an LRU |
Hm, looking at psutil, it probably doesn't double the memory usage. I'm not sure if there are any good alternatives, though. I think Any ideas? |
I looked at the example in #29411 and commented over there: I think the increased memory usage mostly comes from the Series creation overhead, and because the example uses a very wide dataframe (in total 50,000 columns of each 10 rows), this Series creation overhead becomes significant (for long dataframes, you won't notice this). |
Thanks a bunch for the help there. Avoiding |
Agreed item_cache isn't worth the trouble. Technically getting rid of it will be an API change, so let's do it now for 2.0. |
Discussion copied over from #49450
In OP of #49450(discusses turning on the _item_cache for CoW),
Context:
This caching can also have other side effects, though. In investigating #29411, I found that methods like
memory_usage
(also looks likeround
,duplicated
, may be affected from a quick glance at frame.py) that iterate through all the columns by calling.items()
, will actually cause all the columns to be cached in _item_cache, which blows up memory usage.This might be tricky to do, though, as Joris noted, since this would be a behavior change.
We should discuss here how we want to go about doing this(needs deprecation?).
The text was updated successfully, but these errors were encountered: