Performance optimization in btree.c. (CVS 2990)

FossilOrigin-Name: 3e1e6affe256a950a81ad5939b628bafb8463b42
This commit is contained in:
drh 2006-01-22 21:52:56 +00:00
parent eda639e111
commit 504b69898b
4 changed files with 21 additions and 16 deletions

View File

@ -1,5 +1,5 @@
C Code\ssize\sreductions\sin\sselect.c.\s(CVS\s2989) C Performance\soptimization\sin\sbtree.c.\s(CVS\s2990)
D 2006-01-22T00:42:09 D 2006-01-22T21:52:57
F Makefile.in ab3ffd8d469cef4477257169b82810030a6bb967 F Makefile.in ab3ffd8d469cef4477257169b82810030a6bb967
F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092 F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -34,7 +34,7 @@ F src/alter.c 90b779cf00489535cab6490df6dc050f40e4e874
F src/analyze.c 7d2b7ab9a9c2fd6e55700f69064dfdd3e36d7a8a F src/analyze.c 7d2b7ab9a9c2fd6e55700f69064dfdd3e36d7a8a
F src/attach.c 0081040e9a5d13669b6712e947688c10f030bfc1 F src/attach.c 0081040e9a5d13669b6712e947688c10f030bfc1
F src/auth.c 9ae84d2d94eb96195e04515715e08e85963e96c2 F src/auth.c 9ae84d2d94eb96195e04515715e08e85963e96c2
F src/btree.c c6ebb78756ec98ded27a3cb6678481e0555b6b13 F src/btree.c 9de685a11ede765542a644441340cbed32380c3d
F src/btree.h 5663c4f43e8521546ccebc8fc95acb013b8f3184 F src/btree.h 5663c4f43e8521546ccebc8fc95acb013b8f3184
F src/build.c 15224e2fd348ad32b9044aaa5bdc912e4067da15 F src/build.c 15224e2fd348ad32b9044aaa5bdc912e4067da15
F src/callback.c 1bf497306c32229114f826707054df7ebe10abf2 F src/callback.c 1bf497306c32229114f826707054df7ebe10abf2
@ -66,7 +66,7 @@ F src/pragma.c 4496cc77dc35824e1c978c3d1413b8a5a4c777d3
F src/prepare.c 5d6f5b7194ee72cecd66cab49d15159e55d63f28 F src/prepare.c 5d6f5b7194ee72cecd66cab49d15159e55d63f28
F src/printf.c f47a2f4b5387cd2ebb12e9117a1a5d6bd9a2b812 F src/printf.c f47a2f4b5387cd2ebb12e9117a1a5d6bd9a2b812
F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261 F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261
F src/select.c bdfc4b1615757a75cc999a6264f791bd133c0c49 F src/select.c 11ad28afb33bb83b655074c87557d4686c67f92f
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96 F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
F src/shell.c 66b073375efbdee19045e7e0cd38b85f9aff71da F src/shell.c 66b073375efbdee19045e7e0cd38b85f9aff71da
F src/sqlite.h.in 492580f7e3ff71eb43193eb7bb98e2d549889ce3 F src/sqlite.h.in 492580f7e3ff71eb43193eb7bb98e2d549889ce3
@ -344,7 +344,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 72a067f0df5818c0fdb3b9f8af20f83bb2e1dd34 P 3c2eee5e1f6c7d701a6d362a04cf896d44e97fd9
R 7149efc6bca05d61f3d140a668bc0541 R 79b2ebcd5c87d6676140e58c49de75b7
U drh U drh
Z 8f5502aac66dc065c601250997c9db38 Z fd205e297bbdc82d40fc2de1ce715a4f

View File

@ -1 +1 @@
3c2eee5e1f6c7d701a6d362a04cf896d44e97fd9 3e1e6affe256a950a81ad5939b628bafb8463b42

View File

@ -9,7 +9,7 @@
** May you share freely, never taking more than you give. ** May you share freely, never taking more than you give.
** **
************************************************************************* *************************************************************************
** $Id: btree.c,v 1.306 2006/01/21 12:08:54 danielk1977 Exp $ ** $Id: btree.c,v 1.307 2006/01/22 21:52:57 drh Exp $
** **
** This file implements a external (disk-based) database using BTrees. ** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to ** For a detailed discussion of BTrees, refer to
@ -462,7 +462,8 @@ static void put4byte(unsigned char *p, u32 v){
** file. ** file.
*/ */
#define getVarint sqlite3GetVarint #define getVarint sqlite3GetVarint
#define getVarint32 sqlite3GetVarint32 /* #define getVarint32 sqlite3GetVarint32 */
#define getVarint32(A,B) ((*B=*(A))<=0x7f?1:sqlite3GetVarint32(A,B))
#define putVarint sqlite3PutVarint #define putVarint sqlite3PutVarint
/* The database page the PENDING_BYTE occupies. This page is never used. /* The database page the PENDING_BYTE occupies. This page is never used.
@ -920,12 +921,16 @@ static void parseCellPtr(
}else{ }else{
nPayload = 0; nPayload = 0;
} }
n += getVarint(&pCell[n], (u64 *)&pInfo->nKey);
pInfo->nHeader = n;
pInfo->nData = nPayload; pInfo->nData = nPayload;
if( !pPage->intKey ){ if( pPage->intKey ){
nPayload += pInfo->nKey; n += getVarint(&pCell[n], (u64 *)&pInfo->nKey);
}else{
u32 x;
n += getVarint32(&pCell[n], &x);
pInfo->nKey = x;
nPayload += x;
} }
pInfo->nHeader = n;
if( nPayload<=pPage->maxLocal ){ if( nPayload<=pPage->maxLocal ){
/* This is the (easy) common case where the entire payload fits /* This is the (easy) common case where the entire payload fits
** on the local page. No overflow is required. ** on the local page. No overflow is required.

View File

@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser ** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite. ** to handle SELECT statements in SQLite.
** **
** $Id: select.c,v 1.298 2006/01/22 00:42:09 drh Exp $ ** $Id: select.c,v 1.299 2006/01/22 21:52:57 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@ -566,7 +566,7 @@ static int selectInnerLoop(
break; break;
} }
/* If any row exists in the result set, record that fact and abort. /* If any row exist in the result set, record that fact and abort.
*/ */
case SRT_Exists: { case SRT_Exists: {
sqlite3VdbeAddOp(v, OP_MemInt, 1, iParm); sqlite3VdbeAddOp(v, OP_MemInt, 1, iParm);