]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Simplification to the insertCell() routine in btree.c, resulting in a
authordrh <drh@noemail.net>
Sat, 11 Oct 2014 17:22:55 +0000 (17:22 +0000)
committerdrh <drh@noemail.net>
Sat, 11 Oct 2014 17:22:55 +0000 (17:22 +0000)
performance boost and a very small size decrease.  It turns out that the
extra work involved in sometimes avoiding an memcpy() of the first four bytes
of a record takes more time than just unconditionally copying those
four bytes.

FossilOrigin-Name: 66de15580d3c289601e67debfe1edee286f4db5f

manifest
manifest.uuid
src/btree.c

index f11096d9d220759f7aaeda43831e09ec6dc9a1ae..517771d6a6eb6db5eb97830c2bbf58319357b282 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Require\sthe\sSQLITE_ENABLE_RTREE\scompile-time\soption\sin\sspeedtest1.c\sin\sorder\nto\senable\sthe\sR-Tree\stests.
-D 2014-10-11T10:52:54.590
+C Simplification\sto\sthe\sinsertCell()\sroutine\sin\sbtree.c,\sresulting\sin\sa\nperformance\sboost\sand\sa\svery\ssmall\ssize\sdecrease.\s\sIt\sturns\sout\sthat\sthe\nextra\swork\sinvolved\sin\ssometimes\savoiding\san\smemcpy()\sof\sthe\sfirst\sfour\sbytes\nof\sa\srecord\stakes\smore\stime\sthan\sjust\sunconditionally\scopying\sthose\nfour\sbytes.
+D 2014-10-11T17:22:55.486
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -172,7 +172,7 @@ F src/auth.c d8abcde53426275dab6243b441256fcd8ccbebb2
 F src/backup.c a31809c65623cc41849b94d368917f8bb66e6a7e
 F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
 F src/btmutex.c 49ca66250c7dfa844a4d4cb8272b87420d27d3a5
-F src/btree.c fa00618117fb6bb46c243452c56997c0d22d4fc9
+F src/btree.c 5c0b78c49d00da49a0e8e3d2738900a431df7fca
 F src/btree.h a79aa6a71e7f1055f01052b7f821bd1c2dce95c8
 F src/btreeInt.h 1bd7957161a1346a914f1f09231610e777a8e58d
 F src/build.c 9e5205db9a0c8a1a4ce7379d60a2a34cb0b7339c
@@ -1204,7 +1204,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 7a32fdfd4be2138c0ab00f3dc6f54a70e4e07be4
-R 4281e286fbeeaa18c9716d9bb0cdd63c
+P 5d29a033b0f17b0fd74656b28a8367a9a9067f81
+R 8d2ebada6cfcd93628f86065b0703bad
 U drh
-Z 50870d5e316ccf74380338fbaf696334
+Z b915e33ee9cbdc5e832f0d58216a79da
index 44905c9e549a4aa046fc15bc11e5f5fb146be7c8..e1067663de1451bb42673fda288fe4b4fd6749da 100644 (file)
@@ -1 +1 @@
-5d29a033b0f17b0fd74656b28a8367a9a9067f81
\ No newline at end of file
+66de15580d3c289601e67debfe1edee286f4db5f
\ No newline at end of file
index 12dcb44cba51ff5ba3c85f06cf8c831e9a601362..cfe623342a5d94584994442e38546cdbd2d0bf14 100644 (file)
@@ -5845,11 +5845,6 @@ static void dropCell(MemPage *pPage, int idx, int sz, int *pRC){
 ** in pTemp or the original pCell) and also record its index. 
 ** Allocating a new entry in pPage->aCell[] implies that 
 ** pPage->nOverflow is incremented.
-**
-** If nSkip is non-zero, then do not copy the first nSkip bytes of the
-** cell. The caller will overwrite them after this function returns. If
-** nSkip is non-zero, then pCell may not point to an invalid memory location 
-** (but pCell+nSkip is always valid).
 */
 static void insertCell(
   MemPage *pPage,   /* Page into which we are copying */
@@ -5866,7 +5861,6 @@ static void insertCell(
   int ins;          /* Index in data[] where new cell pointer is inserted */
   int cellOffset;   /* Address of first cell pointer in data[] */
   u8 *data;         /* The content of the whole page */
-  int nSkip = (iChild ? 4 : 0);
 
   if( *pRC ) return;
 
@@ -5884,7 +5878,7 @@ static void insertCell(
   assert( sz==cellSizePtr(pPage, pCell) || (sz==8 && iChild>0) );
   if( pPage->nOverflow || sz+2>pPage->nFree ){
     if( pTemp ){
-      memcpy(pTemp+nSkip, pCell+nSkip, sz-nSkip);
+      memcpy(pTemp, pCell, sz);
       pCell = pTemp;
     }
     if( iChild ){
@@ -5913,7 +5907,7 @@ static void insertCell(
     assert( idx+sz <= (int)pPage->pBt->usableSize );
     pPage->nCell++;
     pPage->nFree -= (u16)(2 + sz);
-    memcpy(&data[idx+nSkip], pCell+nSkip, sz-nSkip);
+    memcpy(&data[idx], pCell, sz);
     if( iChild ){
       put4byte(&data[idx], iChild);
     }