aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2023-06-09 15:54:18 +0000
committerdrh <>2023-06-09 15:54:18 +0000
commit7520116441617c4e34cf8d81a6013c760e00b542 (patch)
tree92d00d0988d240ce555efd062e2bf520e111abdb /src
parent6e4ff8707e884e2dc7430737b3d75a7c131c313c (diff)
downloadsqlite-7520116441617c4e34cf8d81a6013c760e00b542.tar.gz
sqlite-7520116441617c4e34cf8d81a6013c760e00b542.zip
Simplify a memcpy() in defragmentPage(). It now might copy more content than
is strictly necessary, but runs faster and uses less code space. Possible reasons for the improved performance: (1) the copy is now always 8-byte aligned, (2) fewer intermediate results are required which means less register pressure which helps the compiler to optimize the subroutine. FossilOrigin-Name: 6e5607ae4d872954483a8d7a5c866aa41e4af70fae9652fb7eb211b316ab724d
Diffstat (limited to 'src')
-rw-r--r--src/btree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/btree.c b/src/btree.c
index 9d6bdf2e5..5626bf53d 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -1635,7 +1635,7 @@ static int defragmentPage(MemPage *pPage, int nMaxFrag){
iCellStart = get2byte(&data[hdr+5]);
if( nCell>0 ){
temp = sqlite3PagerTempSpace(pPage->pBt->pPager);
- memcpy(&temp[iCellStart], &data[iCellStart], usableSize - iCellStart);
+ memcpy(temp, data, usableSize);
src = temp;
for(i=0; i<nCell; i++){
u8 *pAddr; /* The i-th cell pointer */