]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Avoid unnecessary calls to sqlite3VdbeSerialTypeLen() for integer
authordrh <drh@noemail.net>
Sun, 28 Jun 2015 02:58:51 +0000 (02:58 +0000)
committerdrh <drh@noemail.net>
Sun, 28 Jun 2015 02:58:51 +0000 (02:58 +0000)
serial types, for a small size reduction and a speed increase.

FossilOrigin-Name: 9cd30d33b1d02dc8c55c1d74bdbcefab63ebf2a7

manifest
manifest.uuid
src/vdbeaux.c

index e93f7ee73e7a05e4b98896d4174e9415f07b8cdb..31eb85101aee7893947e24a3039cdeb2272c196b 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Make\sgreater\suse\sof\sBtCursor.curIntKey.
-D 2015-06-27T23:55:20.211
+C Avoid\sunnecessary\scalls\sto\ssqlite3VdbeSerialTypeLen()\sfor\sinteger\nserial\stypes,\sfor\sa\ssmall\ssize\sreduction\sand\sa\sspeed\sincrease.
+D 2015-06-28T02:58:51.359
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 285a0a234ed7610d431d91671c136098c2bd86a9
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -394,7 +394,7 @@ F src/vdbe.c 3d5a78d39b15dc91ea2c11017d560a4224eb2f75
 F src/vdbe.h 7a75045d879118b9d3af7e8b3c108f2f27c51473
 F src/vdbeInt.h 8b54e01ad0463590e7cffabce0bc36da9ee4f816
 F src/vdbeapi.c 6a0d7757987018ff6b1b81bc5293219cd26bb299
-F src/vdbeaux.c 13261b7597c7f189232f84a1e175a3268ea2c32b
+F src/vdbeaux.c 54bcc56d368b2d0bebc523cff514893156c09daf
 F src/vdbeblob.c 4f2e8e075d238392df98c5e03a64342465b03f90
 F src/vdbemem.c ae38a0d35ae71cf604381a887c170466ba518090
 F src/vdbesort.c f5009e7a35e3065635d8918b9a31f498a499976b
@@ -1364,7 +1364,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 4a17df139ac41e29c9a2e58afbd1238a5e94bd36
-R 951a5590bfe7a8b4e737119af9769202
+P 63998471d023dd846d5583ac856e2acc47ad41ea
+R 212ca1fcb98a576a11f4bdf11ee3ebc0
 U drh
-Z 51f9425184670e22671d083e0bae99bd
+Z 171de1cc147222ccddab9bfa4a1ca423
index 02124d128bc33cad1b475062ae49224b100164a1..64424134b86b3d89d4f63d5dd0d4c06e295f2008 100644 (file)
@@ -1 +1 @@
-63998471d023dd846d5583ac856e2acc47ad41ea
\ No newline at end of file
+9cd30d33b1d02dc8c55c1d74bdbcefab63ebf2a7
\ No newline at end of file
index 05a6952334f8a9839f698b30195d88c8846d5677..5dbbadaa2b2811d121b8eaac1b013b6bfcf61c5b 100644 (file)
@@ -2961,6 +2961,13 @@ u32 sqlite3VdbeSerialType(Mem *pMem, int file_format){
   return ((n*2) + 12 + ((flags&MEM_Str)!=0));
 }
 
+/*
+** The sizes for serial types less than 12
+*/
+static const u8 sqlite3SmallTypeSizes[] = {
+  0, 1, 2, 3, 4, 6, 8, 8, 0, 0, 0, 0
+};
+
 /*
 ** Return the length of the data corresponding to the supplied serial-type.
 */
@@ -2968,8 +2975,7 @@ u32 sqlite3VdbeSerialTypeLen(u32 serial_type){
   if( serial_type>=12 ){
     return (serial_type-12)/2;
   }else{
-    static const u8 aSize[] = { 0, 1, 2, 3, 4, 6, 8, 8, 0, 0, 0, 0 };
-    return aSize[serial_type];
+    return sqlite3SmallTypeSizes[serial_type];
   }
 }
 
@@ -3053,7 +3059,7 @@ u32 sqlite3VdbeSerialPut(u8 *buf, Mem *pMem, u32 serial_type){
     }else{
       v = pMem->u.i;
     }
-    len = i = sqlite3VdbeSerialTypeLen(serial_type);
+    len = i = sqlite3SmallTypeSizes[serial_type];
     assert( i>0 );
     do{
       buf[--i] = (u8)(v&0xFF);
@@ -4082,7 +4088,7 @@ int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *rowid){
   if( unlikely(typeRowid<1 || typeRowid>9 || typeRowid==7) ){
     goto idx_rowid_corruption;
   }
-  lenRowid = sqlite3VdbeSerialTypeLen(typeRowid);
+  lenRowid = sqlite3SmallTypeSizes[typeRowid];
   testcase( (u32)m.n==szHdr+lenRowid );
   if( unlikely((u32)m.n<szHdr+lenRowid) ){
     goto idx_rowid_corruption;