Skip to content

PERF: __slots__ not declared consistently, negating some memory savings #45124

@ariebovenberg

Description

@ariebovenberg

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this issue exists on the latest version of pandas.

  • I have confirmed this issue exists on the master branch of pandas.

Reproducible Example

👋 Hello there!

I've found quite some classes declaring __slots__ whose bases classes do not. This negates some of the performance benefits. Fixing this should be a relatively easy performance win.

After some experimentation I've found it's not quite as easy as adding __slots__ = () to the bases classes. But, it should still be relatively simple.

List of affected classes I could find:

pandas.core.internals.array_manager.BaseArrayManager
pandas.core.internals.array_manager.SingleArrayManager
pandas.core.internals.blocks.Block
pandas.core.internals.blocks.CategoricalBlock
pandas.core.internals.blocks.DatetimeLikeBlock
pandas.core.internals.blocks.NumericBlock
pandas.core.internals.blocks.ObjectBlock
pandas.core.internals.managers.BaseBlockManager
pandas.core.internals.managers.SingleBlockManager

Installed Versions

n/a

Prior Performance

No response

Metadata

Metadata

Assignees

Labels

PerformanceMemory or execution speed performance

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions