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

Performance improvement: reduce the number of calls to ptrmapPageno() made by ptrmapPut() and ptrmapGet(). (CVS 5437)

FossilOrigin-Name: d807fb271340901bbf3e06de23d91132422d1408
This commit is contained in:
danielk1977
2008-07-18 09:34:57 +00:00
parent d3c4bad7fe
commit 8c666b1666
4 changed files with 13 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
C Speed\sup\ssqlite3_finalize()\sby\sremoving\sredundant\scode.\s(CVS\s5436) C Performance\simprovement:\sreduce\sthe\snumber\sof\scalls\sto\sptrmapPageno()\smade\sby\sptrmapPut()\sand\sptrmapGet().\s(CVS\s5437)
D 2008-07-18T08:10:47 D 2008-07-18T09:34:57
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in a03f7cb4f7ad50bc53a788c6c544430e81f95de4 F Makefile.in a03f7cb4f7ad50bc53a788c6c544430e81f95de4
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -96,9 +96,9 @@ F src/attach.c b18ba42c77f7d3941f5d23d2ca20fa1d841a4e91
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627 F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
F src/bitvec.c 95c86bd18d8fedf0533f5af196192546e10a7e7d F src/bitvec.c 95c86bd18d8fedf0533f5af196192546e10a7e7d
F src/btmutex.c 709cad2cdca0afd013f0f612363810e53f59ec53 F src/btmutex.c 709cad2cdca0afd013f0f612363810e53f59ec53
F src/btree.c af2bc332a50f5f364ba2cb00c728203f9a1d004b F src/btree.c 95640f016d8f5e086a06d37d5d24d45f54582aff
F src/btree.h 03256ed7ee42b5ecacbe887070b0f8249e7d069d F src/btree.h 03256ed7ee42b5ecacbe887070b0f8249e7d069d
F src/btreeInt.h e5b952467935fc29033da138c3d74673329d9770 F src/btreeInt.h 6e4cb69a9192a8d609c27034ae5f921cf0ecdde1
F src/build.c bac7233d984be3805aaa41cf500f7ee12dc97249 F src/build.c bac7233d984be3805aaa41cf500f7ee12dc97249
F src/callback.c aa492a0ad8c2d454edff9fb8a57fae13743cf71d F src/callback.c aa492a0ad8c2d454edff9fb8a57fae13743cf71d
F src/complete.c cb14e06dbe79dee031031f0d9e686ff306afe07c F src/complete.c cb14e06dbe79dee031031f0d9e686ff306afe07c
@@ -608,7 +608,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1 F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P 70685b2ae8bbb8ab4316a762e1c1cc59b8032e0b P c94318b982e9bb5b4c743cf8d5659f9eec697366
R 0fac37338ff457c8a8ccb096c255b171 R 1c9e4fce9b074d6791cf7915301ae383
U danielk1977 U danielk1977
Z 5ba21847fa73d9eab64482a9b27dcd85 Z a5d1990c3bbe25fa6befea839cd03776

View File

@@ -1 +1 @@
c94318b982e9bb5b4c743cf8d5659f9eec697366 d807fb271340901bbf3e06de23d91132422d1408

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.487 2008/07/18 03:32:51 drh Exp $ ** $Id: btree.c,v 1.488 2008/07/18 09:34:57 danielk1977 Exp $
** **
** This file implements a external (disk-based) database using BTrees. ** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information. ** See the header comment on "btreeInt.h" for additional information.
@@ -458,7 +458,7 @@ static int ptrmapPut(BtShared *pBt, Pgno key, u8 eType, Pgno parent){
if( rc!=SQLITE_OK ){ if( rc!=SQLITE_OK ){
return rc; return rc;
} }
offset = PTRMAP_PTROFFSET(pBt, key); offset = PTRMAP_PTROFFSET(iPtrmap, key);
pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage); pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);
if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){ if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){
@@ -497,7 +497,7 @@ static int ptrmapGet(BtShared *pBt, Pgno key, u8 *pEType, Pgno *pPgno){
} }
pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage); pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);
offset = PTRMAP_PTROFFSET(pBt, key); offset = PTRMAP_PTROFFSET(iPtrmap, key);
assert( pEType!=0 ); assert( pEType!=0 );
*pEType = pPtrmap[offset]; *pEType = pPtrmap[offset];
if( pPgno ) *pPgno = get4byte(&pPtrmap[offset+1]); if( pPgno ) *pPgno = get4byte(&pPtrmap[offset+1]);

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: btreeInt.h,v 1.28 2008/07/18 02:44:18 drh Exp $ ** $Id: btreeInt.h,v 1.29 2008/07/18 09:34:57 danielk1977 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
@@ -527,7 +527,7 @@ struct BtLock {
** this test. ** this test.
*/ */
#define PTRMAP_PAGENO(pBt, pgno) ptrmapPageno(pBt, pgno) #define PTRMAP_PAGENO(pBt, pgno) ptrmapPageno(pBt, pgno)
#define PTRMAP_PTROFFSET(pBt, pgno) (5*(pgno-ptrmapPageno(pBt, pgno)-1)) #define PTRMAP_PTROFFSET(pgptrmap, pgno) (5*(pgno-pgptrmap-1))
#define PTRMAP_ISPAGE(pBt, pgno) (PTRMAP_PAGENO((pBt),(pgno))==(pgno)) #define PTRMAP_ISPAGE(pBt, pgno) (PTRMAP_PAGENO((pBt),(pgno))==(pgno))
/* /*