Uh oh!
There was an error while loading. Please reload this page.
bpo-37029: keep usable_arenas in sorted order without searching - #13612
Conversation
sorted by number of free pools.
Uh oh!
There was an error while loading. Please reload this page.
| @@ -1172,6 +1189,9 @@ static struct arena_object* unused_arena_objects = NULL; | |||
| */ | |||
There was a problem hiding this comment.
Add comment documenting that they are sorted in number of free pools?
There was a problem hiding this comment.
I'd rather not, unless you feel strongly about it. This has been documented all along, but up where the main explanation of arenas lives (look at the comment block about usable_arenas at line 1150).
There are a bunch of moving parts here, and the style of the file is to give long-ish English explanations in uninterrupted comment blocks, with only the briefest of memory-jogging comments on declaration lines.
bedevere-bot
commented
Jun 1, 2019
@tim-one: Please replace |
…on#13612) This adds a vector of "search fingers" so that usable_arenas can be kept in sorted order (by number of free pools) via constant-time operations instead of linear search. This should reduce worst-case time for reclaiming a great many objects from O(A**2) to O(A), where A is the number of arenas. See bpo-37029.
This adds a vector of "search fingers" so that usable_arenas can be kept in sorted order (by number of free pools) via constant-time operations instead of linear search.
This should reduce worst-case time for reclaiming a great many objects from O(A**2) to O(A), where A is the number of arenas.
https://bugs.python.org/issue37029