File tree Expand file tree Collapse file tree 2 files changed +3
-21
lines changed
Expand file tree Collapse file tree 2 files changed +3
-21
lines changed Original file line number Diff line number Diff line change 1+ Remove freelist from collections.deque().
Original file line number Diff line number Diff line change @@ -117,23 +117,9 @@ static PyTypeObject deque_type;
117117#define CHECK_NOT_END (link )
118118#endif
119119
120- /* A simple freelisting scheme is used to minimize calls to the memory
121- allocator. It accommodates common use cases where new blocks are being
122- added at about the same rate as old blocks are being freed.
123- */
124-
125- #define MAXFREEBLOCKS 16
126- static Py_ssize_t numfreeblocks = 0 ;
127- static block * freeblocks [MAXFREEBLOCKS ];
128-
129120static block *
130121newblock (void ) {
131- block * b ;
132- if (numfreeblocks ) {
133- numfreeblocks -- ;
134- return freeblocks [numfreeblocks ];
135- }
136- b = PyMem_Malloc (sizeof (block ));
122+ block * b = PyMem_Malloc (sizeof (block ));
137123 if (b != NULL ) {
138124 return b ;
139125 }
@@ -144,12 +130,7 @@ newblock(void) {
144130static void
145131freeblock (block * b )
146132{
147- if (numfreeblocks < MAXFREEBLOCKS ) {
148- freeblocks [numfreeblocks ] = b ;
149- numfreeblocks ++ ;
150- } else {
151- PyMem_Free (b );
152- }
133+ PyMem_Free (b );
153134}
154135
155136static PyObject *
You can’t perform that action at this time.
0 commit comments