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
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/markshannon'closed_at=<Date2022-03-03.12:16:00.251>created_at=<Date2022-02-07.11:52:04.597>labels= ['3.11']
title='Allow more than 16 items in split-keys dicts and "virtual" object dicts.'updated_at=<Date2022-03-03.12:16:00.251>user='https://github.com/markshannon'
In order for this to work, we need to keep the insertion order on the values. The initial version (#28802) used a 64 bit value as a vector of 16 4-bit values, which allows only 16 items per values array.
Stats gathered from the standard benchmark suite and informal evidence from elsewhere suggests that this causes a significant (5% and upwards) of these dicts to be materialized due to exceeding the 16 item limit.
An alternative design that would allow up to ~254 items in the values array is to make the insertion order vector an array of bytes. The capacity is 254 as we need a byte for size, and another for capacity.
This will increase the size of the values a bit for sizes from 7 to 15, but save a lot of memory for sizes 17+, as keys could still be shared.
Pros:
No need to materialize dicts of size 16+, saving ~3/4 of the memory per dict and helping specialization.
Cons:
Extra memory write to store a value*
1 extra word for values of size 7 to 14, 2 extra for size 15.
Some extra complexity.
*In a hypothetical optimized JIT, the insertion order vector would be stored as a single write for several writes, so this would make no difference.
New changeset 25db2b3 by Mark Shannon in branch 'main': bpo-46675: Allow object value arrays and split key dictionaries larger than 16 (GH-31191) 25db2b3
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: