]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Performance boost in sqlite3VdbeRecordCompare. (CVS 2929)
authordrh <drh@noemail.net>
Thu, 12 Jan 2006 20:28:35 +0000 (20:28 +0000)
committerdrh <drh@noemail.net>
Thu, 12 Jan 2006 20:28:35 +0000 (20:28 +0000)
FossilOrigin-Name: 14c423075bcebf42a3f4e24838bc865cfb90afda

manifest
manifest.uuid
src/vdbeaux.c

index 24aac7fc13d3234c4c4be3cacf3252d4ad0d7e1d..f79e868ab65630f7c08986a0c44d768eaa6ab537 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Automatically\scast\sBLOBs\sto\sstrings\sprior\sto\shanding\sthem\sover\sto\nfunctions\slike\sLIKE\sthat\swant\sstrings.\s\sTicket\s#1605.\s(CVS\s2928)
-D 2006-01-12T19:42:41
+C Performance\sboost\sin\ssqlite3VdbeRecordCompare.\s(CVS\s2929)
+D 2006-01-12T20:28:35
 F Makefile.in ab3ffd8d469cef4477257169b82810030a6bb967
 F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -91,7 +91,7 @@ F src/vdbe.c 59df15f96354ddd051212499e0cf4a3392c522c1
 F src/vdbe.h 8729a4ee16ff9aeab2af9667df3cf300ff978e13
 F src/vdbeInt.h 5451cf71f229e366ac543607c0a17f36e5737ea9
 F src/vdbeapi.c afd3837cea0dec93dcb4724d073c84fa0da68e23
-F src/vdbeaux.c b3ac00584f18df9b4ca703ed30f3a378d7a975f7
+F src/vdbeaux.c 23ff126058826a41405f1cd4bff800476d6c633c
 F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
 F src/vdbemem.c dd08a0eea4868ac4a2d91fdec32424308b1db772
 F src/where.c a8ba7f4aa2f38166e9f89ecc5dafbdbf41942031
@@ -340,7 +340,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 6d2a816ede8d17b993a21e418cf25edd103334de
-R 971a03416cb2a532e33c04d063ff3d43
+P 730ddb0b74ed23c916dabd7ce893bd6bc55f3549
+R 36b85235284a365ef7c4f8a7c8bf02e6
 U drh
-Z f5d21c5f0dab7a424c492c72d03de3db
+Z 308f9bd267f3ff57a7f1fa05f779432c
index 07d5fbed7a1e56e965fb3e28ca35e7feb71c7e35..99f52e187d8bfe703cb0ea2ebd4bab49e23fe885 100644 (file)
@@ -1 +1 @@
-730ddb0b74ed23c916dabd7ce893bd6bc55f3549
\ No newline at end of file
+14c423075bcebf42a3f4e24838bc865cfb90afda
\ No newline at end of file
index 637bb1bf36f4777bba2f2a67d50b438f526ab3e3..59d4b6415b062c6649e22a2ae07eb617b74f51ea 100644 (file)
@@ -1680,6 +1680,23 @@ int sqlite3VdbeSerialGet(
   return 0;
 }
 
+/*
+** The header of a record consists of a sequence variable-length integers.
+** These integers are almost always small and are encoded as a single byte.
+** The following macro takes advantage this fact to provide a fast decode
+** of the integers in a record header.  It is faster for the common case
+** where the integer is a single byte.  It is a little slower when the
+** integer is two or more bytes.  But overall it is faster.
+**
+** The following expressions are equivalent:
+**
+**     x = sqlite3GetVarint32( A, &B );
+**
+**     x = GetVarint( A, B );
+**
+*/
+#define GetVarint(A,B)  ((B = *(A))<=0x7f ? 1 : sqlite3GetVarint32(A, &B))
+
 /*
 ** This function compares the two table rows or index records specified by 
 ** {nKey1, pKey1} and {nKey2, pKey2}, returning a negative, zero
@@ -1707,9 +1724,9 @@ int sqlite3VdbeRecordCompare(
   mem1.enc = pKeyInfo->enc;
   mem2.enc = pKeyInfo->enc;
   
-  idx1 = sqlite3GetVarint32(pKey1, &szHdr1);
+  idx1 = GetVarint(aKey1, szHdr1);
   d1 = szHdr1;
-  idx2 = sqlite3GetVarint32(pKey2, &szHdr2);
+  idx2 = GetVarint(aKey2, szHdr2);
   d2 = szHdr2;
   nField = pKeyInfo->nField;
   while( idx1<szHdr1 && idx2<szHdr2 ){
@@ -1717,9 +1734,9 @@ int sqlite3VdbeRecordCompare(
     u32 serial_type2;
 
     /* Read the serial types for the next element in each key. */
-    idx1 += sqlite3GetVarint32(&aKey1[idx1], &serial_type1);
+    idx1 += GetVarint( aKey1+idx1, serial_type1 );
     if( d1>=nKey1 && sqlite3VdbeSerialTypeLen(serial_type1)>0 ) break;
-    idx2 += sqlite3GetVarint32(&aKey2[idx2], &serial_type2);
+    idx2 += GetVarint( aKey2+idx2, serial_type2 );
     if( d2>=nKey2 && sqlite3VdbeSerialTypeLen(serial_type2)>0 ) break;
 
     /* Assert that there is enough space left in each key for the blob of