]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Move the leftlink to the end of the block structure.
authorRaymond Hettinger <python@rcn.com>
Tue, 16 Jul 2013 08:59:30 +0000 (01:59 -0700)
committerRaymond Hettinger <python@rcn.com>
Tue, 16 Jul 2013 08:59:30 +0000 (01:59 -0700)
The current pattern of memory access will update both the leftlink and
rightlink at the same time, so they should be positioned side-by-side
for better cache locality.

Keeping the leftlink at the front of the structure would make sense
only if the paired updates were eliminated by backporting changesets
49a9c734304d3555cc0ca35bae9ee46bd471, and 744dd749e25b.  However,
that isn't likely to happen, so we're better off with the leftlink at
the end of the structure.

Modules/_collectionsmodule.c

index f175fcaa0ea185b20d7140b01bc499b10e362d2b..b0fa23dfa1877836ac8417833d597e56eef037b5 100644 (file)
@@ -47,9 +47,9 @@
  */
 
 typedef struct BLOCK {
-    struct BLOCK *leftlink;
     PyObject *data[BLOCKLEN];
     struct BLOCK *rightlink;
+    struct BLOCK *leftlink;
 } block;
 
 #define MAXFREEBLOCKS 10