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

gh-90861: Memory optimization for set.issubset #92799

Merged
merged 3 commits into from
May 14, 2022
Merged

Conversation

corona10
Copy link
Member

Co-authored-by: Jack Nguyen nguyej17@my.erau.edu

closes: gh-90861

Co-authored-by: Jack Nguyen <nguyej17@my.erau.edu>
@corona10 corona10 marked this pull request as ready for review May 14, 2022 07:42
@corona10 corona10 requested a review from rhettinger as a code owner May 14, 2022 07:42
@corona10
Copy link
Member Author


➜  cpython git:(gh-90861) ✗ ./python.exe -m test test_set -R 3:3
Raised RLIMIT_NOFILE: 256 -> 1024
0:00:00 load avg: 2.06 Run tests sequentially
0:00:00 load avg: 2.06 [1/1] test_set
beginning 6 repetitions
123456
......

== Tests result: SUCCESS ==

1 test OK.

Total duration: 21.7 sec
Tests result: SUCCESS

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

This is virtually the correct implementation of #31267.

But it could be more compact:

int result = (PySet_GET_SIZE(tmp) == PySet_GET_SIZE(so));
Py_DECREF(tmp);
return PyBool_FromLong(result);

or

Py_ssize_t size = PySet_GET_SIZE(tmp);
Py_DECREF(tmp);
return PyBool_FromLong(size == PySet_GET_SIZE(so));

@serhiy-storchaka
Copy link
Member

Thank you for reviving this @corona10.

@corona10 corona10 merged commit 2e8f721 into python:main May 14, 2022
@corona10 corona10 deleted the gh-90861 branch May 14, 2022 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Memory optimization for set.issubset
3 participants