> > I don't know whether the overallocation would make similar-sized room > > at both ends, or whether it would take the current operation into > > account. For the specific case of queues, we may find that doing > > *just* the copying might be sufficient, with no need to go to the > > allocator. > > Hm. An idea: don't bother overallocating when inserting in the front, > but do keep the free space in the front if possible. Then recommend > that queus are implemented using append(x) and pop(0), rather than > using insert(0, x) and pop(). That is a reasonable approach and probably not difficult to implement. Since external code (outside listobject.c) may already be relying on ob_item, the approach should just change that field to always point to the start of valid data. A new field would have to keep a pointer to the actual allocated block. Raymond Hettinger ################################################################# ################################################################# ################################################################# ##### ##### ##### ################################################################# ################################################################# #################################################################
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4