[Python-checkins] cpython: Optimization guides suggest copying memory in an ascending direction when
raymond.hettinger
python-checkins at python.org
Mon Feb 2 07:53:47 CET 2015
https://hg.python.org/cpython/rev/673191aa1724
changeset: 94460:673191aa1724
parent: 94458:31dc5a40d2ab
user: Raymond Hettinger <python at rcn.com>
date: Sun Feb 01 22:53:41 2015 -0800
summary:
Optimization guides suggest copying memory in an ascending direction when possible.
files:
Modules/_collectionsmodule.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -534,13 +534,13 @@
if (m > leftindex)
m = leftindex;
assert (m > 0 && m <= len);
- src = &rightblock->data[rightindex];
- dest = &leftblock->data[leftindex - 1];
rightindex -= m;
leftindex -= m;
+ src = &rightblock->data[rightindex + 1];
+ dest = &leftblock->data[leftindex];
n -= m;
do {
- *(dest--) = *(src--);
+ *(dest++) = *(src++);
} while (--m);
}
if (rightindex == -1) {
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list