]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Use memmove() rather than a home-made copy loop in dropCell() of btree.c,
authordrh <drh@noemail.net>
Mon, 9 Dec 2013 01:58:11 +0000 (01:58 +0000)
committerdrh <drh@noemail.net>
Mon, 9 Dec 2013 01:58:11 +0000 (01:58 +0000)
for a size reduction and performance improvement.

FossilOrigin-Name: 78e1706804e88a0dd5dc40bee838a3a504cfa53b

manifest
manifest.uuid
src/btree.c

index a15d84d948e5156d52488c90071e64673c22eafc..ee8f50545e5a021c5ae2c5a3f17bfb8d2a3e3096 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Avoid\sunnecessary\sno-op\scalls\sfrom\sgetAndInitPage()\sto\sbtreeInitPage()\s\nin\sthe\sbtree.c\slogic.
-D 2013-12-09T01:04:54.208
+C Use\smemmove()\srather\sthan\sa\shome-made\scopy\sloop\sin\sdropCell()\sof\sbtree.c,\nfor\sa\ssize\sreduction\sand\sperformance\simprovement.
+D 2013-12-09T01:58:11.109
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in e1a9b4258bbde53f5636f4e238c65b7e11459e2b
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -166,7 +166,7 @@ F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
 F src/backup.c 1809a7caa2504233bdddd12f5018422421789537
 F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
 F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
-F src/btree.c 368d2eaeea81254d5c7bf7e3d6c1737e08e1e10e
+F src/btree.c ac25a91a1ec94b361b09fdd99253b248ab0bbefc
 F src/btree.h a61ddebc78c66795a2b93181321a116746302cc9
 F src/btreeInt.h f038e818bfadf75afbd09819ed93c26a333d39e0
 F src/build.c 9b40580b62916612678bdb69ce0286e39c29a862
@@ -1146,7 +1146,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
-P 6996fb34445adedf463b66ed1f339ee1f27ce6e5
-R a6e3d012f7b111fe3cf762bd37b890b8
+P 81f5ae13b2e23daee03151d32515387b7f5ba5e5
+R dff255530828faccbaffbe7aa2a8b29a
 U drh
-Z 69daab0d3610fce7f9ad3f7d6b1dfdc6
+Z 8d4fe309cbbd963b83317f42164d5ecb
index e4ff31ef4af29a485bf62b138723cb156f62e342..ad3f97d213ddab0517152f58f55670e46e235152 100644 (file)
@@ -1 +1 @@
-81f5ae13b2e23daee03151d32515387b7f5ba5e5
\ No newline at end of file
+78e1706804e88a0dd5dc40bee838a3a504cfa53b
\ No newline at end of file
index 7f4e83f5f64da75ed64c0fcba200f3f8f2989ae3..df53050373daaf2741e23e6bb76e8f495bafab84 100644 (file)
@@ -5671,7 +5671,6 @@ static void dropCell(MemPage *pPage, int idx, int sz, int *pRC){
   u32 pc;         /* Offset to cell content of cell being deleted */
   u8 *data;       /* pPage->aData */
   u8 *ptr;        /* Used to move bytes around within data[] */
-  u8 *endPtr;     /* End of loop */
   int rc;         /* The return code */
   int hdr;        /* Beginning of the header.  0 most pages.  100 page 1 */
 
@@ -5696,13 +5695,8 @@ static void dropCell(MemPage *pPage, int idx, int sz, int *pRC){
     *pRC = rc;
     return;
   }
-  endPtr = &pPage->aCellIdx[2*pPage->nCell - 2];
-  assert( (SQLITE_PTR_TO_INT(ptr)&1)==0 );  /* ptr is always 2-byte aligned */
-  while( ptr<endPtr ){
-    *(u16*)ptr = *(u16*)&ptr[2];
-    ptr += 2;
-  }
   pPage->nCell--;
+  memmove(ptr, ptr+2, 2*(pPage->nCell - idx));
   put2byte(&data[hdr+3], pPage->nCell);
   pPage->nFree += 2;
 }