You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PyObject_Free is O(N) where N = # of arenas #81210
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/tim-one'closed_at=<Date2019-06-01.02:19:40.540>created_at=<Date2019-05-24.05:33:57.956>labels= ['interpreter-core', '3.8', 'performance']
title='PyObject_Free is O(N) where N = # of arenas'updated_at=<Date2019-06-03.20:51:08.950>user='https://github.com/methane'
Added file arena.py. This adds some code to the OP's original test, to print out build time and teardown time, and display obmalloc stats.
You'll need at least 80GB of RAM to run it - I don't have that much. Building the tree may take on the order of an hour, but the time to tear it down is what's interesting here. Apparently 3.7.3 needs more than 4 hours to reclaim the memory.
I had a bit of time and access to a pretty big machine, so I ran the remove-arena-search branch with the same number of iterations, but also 2x and 4x as many. I attach the output in case it is interesting. The timings seem to be growing linearly with the number of strings. The teardown finishes within minutes.
Activity
methane commentedon May 24, 2019
Reported here:
[-]PyObject_Free is O(N^2) where N = # of arenas[/-][+]PyObject_Free is O(N) where N = # of arenas[/+]tim-one commentedon May 28, 2019
Created a PR and assigned myself to this bug.
tim-one commentedon May 31, 2019
Added file arena.py. This adds some code to the OP's original test, to print out build time and teardown time, and display obmalloc stats.
You'll need at least 80GB of RAM to run it - I don't have that much. Building the tree may take on the order of an hour, but the time to tear it down is what's interesting here. Apparently 3.7.3 needs more than 4 hours to reclaim the memory.
methane commentedon May 31, 2019
master:
build time 0:48:53.664428
teardown time 4:58:20.132930
patched:
build time 0:48:08.485639
teardown time 0:01:10.466707
About 250x speedup!
tim-one commentedon May 31, 2019
Thank you so much, Inada! That's very good to hear :-)
tim-one commentedon Jun 1, 2019
New changeset 1c263e3 by Tim Peters in branch 'master':
bpo-37029: keep usable_arenas in sorted order without searching (bpo-13612)
1c263e3
friedelwolff commentedon Jun 3, 2019
I had a bit of time and access to a pretty big machine, so I ran the remove-arena-search branch with the same number of iterations, but also 2x and 4x as many. I attach the output in case it is interesting. The timings seem to be growing linearly with the number of strings. The teardown finishes within minutes.
tim-one commentedon Jun 3, 2019
Thank you, Friedl! I appreciate the extra confirmation - and especially on even bigger test cases :-)