[Python-checkins] cpython (2.7): Move the leftlink to the end of the block structure.

raymond.hettinger python-checkins at python.org
Tue Jul 16 10:59:46 CEST 2013


http://hg.python.org/cpython/rev/04981ac65138
changeset:   84658:04981ac65138
branch:      2.7
parent:      84650:236e6b995300
user:        Raymond Hettinger <python at rcn.com>
date:        Tue Jul 16 01:59:30 2013 -0700
summary:
  Move the leftlink to the end of the block structure.

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
49a9c734304d, 3555cc0ca35b, ae9ee46bd471, and 744dd749e25b.  However,
that isn't likely to happen, so we're better off with the leftlink at
the end of the structure.

files:
  Modules/_collectionsmodule.c |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -47,9 +47,9 @@
  */
 
 typedef struct BLOCK {
-    struct BLOCK *leftlink;
     PyObject *data[BLOCKLEN];
     struct BLOCK *rightlink;
+    struct BLOCK *leftlink;
 } block;
 
 #define MAXFREEBLOCKS 10

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list