Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix slots usage and use more slots #1987

Merged
merged 1 commit into from
Feb 5, 2020
Merged

Conversation

carsonip
Copy link
Contributor

@carsonip carsonip commented Jan 17, 2020

Use empty slots for ABC classes, otherwise classes which inherit from them will still have __dict__. Also use __slots__ for more classes.


This change is Reviewable

Use empty slots for ABC classes, otherwise classes which inherit from
them will still have __dict__. Also use __slots__ for more classes.
@carsonip
Copy link
Contributor Author

This saves ~200 bytes per object, because the object does not contain a __dict__, and there are also a marginal performance gain:

python benchmarks/record_batch_read.py

before:

.....................
batch_read_v0: Mean +- std dev: 1.23 ms +- 0.06 ms
.....................
batch_read_v1: Mean +- std dev: 1.28 ms +- 0.10 ms
.....................
batch_read_v2: Mean +- std dev: 961 us +- 82 us

after:

.....................
batch_read_v0: Mean +- std dev: 1.18 ms +- 0.05 ms
.....................
batch_read_v1: Mean +- std dev: 1.20 ms +- 0.06 ms
.....................
batch_read_v2: Mean +- std dev: 950 us +- 55 us

Copy link
Contributor

@jeffwidman jeffwidman left a comment

Choose a reason for hiding this comment

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

Thx!

@jeffwidman jeffwidman merged commit d54aaf6 into dpkp:master Feb 5, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants