1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Change BtreeMoveto so that it can be biased to the right or to the center.

Use a right bias when appending and a center bias when searching.  This
gives about a 15% reduction in calls to sqlite3VdbeRecordCompare. (CVS 3741)

FossilOrigin-Name: ad4a6b1a91bcefd8a4c75e8dc99c1153c72c31a3
This commit is contained in:
drh
2007-03-29 05:51:49 +00:00
parent f1d68b3096
commit e4d9081307
13 changed files with 101 additions and 67 deletions

View File

@@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
** $Id: test3.c,v 1.72 2007/03/26 22:05:02 drh Exp $
** $Id: test3.c,v 1.73 2007/03/29 05:51:49 drh Exp $
*/
#include "sqliteInt.h"
#include "pager.h"
@@ -706,9 +706,9 @@ static int btree_move_to(
if( sqlite3BtreeFlags(pCur) & BTREE_INTKEY ){
int iKey;
if( Tcl_GetInt(interp, argv[2], &iKey) ) return TCL_ERROR;
rc = sqlite3BtreeMoveto(pCur, 0, iKey, &res);
rc = sqlite3BtreeMoveto(pCur, 0, iKey, 0, &res);
}else{
rc = sqlite3BtreeMoveto(pCur, argv[2], strlen(argv[2]), &res);
rc = sqlite3BtreeMoveto(pCur, argv[2], strlen(argv[2]), 0, &res);
}
if( rc ){
Tcl_AppendResult(interp, errorName(rc), 0);
@@ -775,7 +775,7 @@ static int btree_insert(
unsigned char *pBuf;
if( Tcl_GetWideIntFromObj(interp, objv[2], &iKey) ) return TCL_ERROR;
pBuf = Tcl_GetByteArrayFromObj(objv[3], &len);
rc = sqlite3BtreeInsert(pCur, 0, iKey, pBuf, len);
rc = sqlite3BtreeInsert(pCur, 0, iKey, pBuf, len, 0);
}else{
int keylen;
int dlen;
@@ -783,7 +783,7 @@ static int btree_insert(
unsigned char *pDBuf;
pKBuf = Tcl_GetByteArrayFromObj(objv[2], &keylen);
pDBuf = Tcl_GetByteArrayFromObj(objv[3], &dlen);
rc = sqlite3BtreeInsert(pCur, pKBuf, keylen, pDBuf, dlen);
rc = sqlite3BtreeInsert(pCur, pKBuf, keylen, pDBuf, dlen, 0);
}
if( rc ){
Tcl_AppendResult(interp, errorName(rc), 0);