]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
An example showing how to improve performance of sqlite3VdbeSerialPut() builtin-bswap64
authordrh <drh@noemail.net>
Mon, 16 Jan 2017 11:54:30 +0000 (11:54 +0000)
committerdrh <drh@noemail.net>
Mon, 16 Jan 2017 11:54:30 +0000 (11:54 +0000)
using the GCC intrinsic function __builtin_bswap64().

FossilOrigin-Name: e42ed9b4adbf4a5cd4ce572d1015f3d2414053aa

manifest
manifest.uuid
src/vdbeaux.c

index d943af780403dcf9244e8eed897847a897ceff1c..1813e261395d06f93b56d8d4a4b60699885058a7 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sproblem\spreventing\sresumption\sof\sRBU\soperations\safter\srecovering\sfrom\sa\nprocess\sor\ssystem\sfailure\sthat\soccurs\sduring\sthe\sincremental-checkpoint\sphase.
-D 2017-01-13T18:24:37.297
+C An\sexample\sshowing\show\sto\simprove\sperformance\sof\ssqlite3VdbeSerialPut()\nusing\sthe\sGCC\sintrinsic\sfunction\s__builtin_bswap64().
+D 2017-01-16T11:54:30.181
 F Makefile.in 41bd4cad981487345c4a84081074bcdb876e4b2e
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc b8ca53350ae545e3562403d5da2a69cec79308da
@@ -460,7 +460,7 @@ F src/vdbe.c c7add5978cb84ae3a7bcb16f8b56cb3bbdf04b7e
 F src/vdbe.h b0866e4191f096f1c987a84b042c3599bdf5423b
 F src/vdbeInt.h 281cb70332dc8b593b8c7afe776f3a2ba7d4255e
 F src/vdbeapi.c d6ebaa465f070eb1af8ba4e7b34583ece87bdd24
-F src/vdbeaux.c 35c9a9908174e5a26c96d15e1f98214814a39147
+F src/vdbeaux.c 54442bffd753cfc400feee9a7e7e689df51016fb
 F src/vdbeblob.c f4f98ea672b242f807c08c92c7faaa79e5091b65
 F src/vdbemem.c 3b5a9a5b375458d3e12a50ae1aaa41eeec2175fd
 F src/vdbesort.c eda25cb2d1727efca6f7862fea32b8aa33c0face
@@ -1545,7 +1545,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 8c85b8fdd7f0ba65fba83361d361a567b797a184
-R dc62936e86267740ae9736f88160b05f
-U dan
-Z f2366ce5ecd39574b5b5eb81b3b99a63
+P 97914266cb4ec63b0c9185ab139673139bd2f0ed
+R c4f7e9fcfe4c1d83ea6964cbcf99c043
+T *branch * builtin-bswap64
+T *sym-builtin-bswap64 *
+T -sym-trunk *
+U drh
+Z cb7b2935a5bb1b1c67b24a56ddd75f5f
index e44a5e66076f1bbfe26f80bbd1d43e8d5bcc62bc..7a881aec804693ee4759de48b4cd4c5180fb18ef 100644 (file)
@@ -1 +1 @@
-97914266cb4ec63b0c9185ab139673139bd2f0ed
\ No newline at end of file
+e42ed9b4adbf4a5cd4ce572d1015f3d2414053aa
\ No newline at end of file
index 85d273f1ec8b84fc0d35c8974bb37530b8f15a63..fee16423a6babe5bf7a898f1783695c1151b5331 100644 (file)
@@ -3321,26 +3321,8 @@ static u64 floatSwap(u64 in){
 */ 
 u32 sqlite3VdbeSerialPut(u8 *buf, Mem *pMem, u32 serial_type){
   u32 len;
-
-  /* Integer and Real */
-  if( serial_type<=7 && serial_type>0 ){
-    u64 v;
-    u32 i;
-    if( serial_type==7 ){
-      assert( sizeof(v)==sizeof(pMem->u.r) );
-      memcpy(&v, &pMem->u.r, sizeof(v));
-      swapMixedEndianFloat(v);
-    }else{
-      v = pMem->u.i;
-    }
-    len = i = sqlite3SmallTypeSizes[serial_type];
-    assert( i>0 );
-    do{
-      buf[--i] = (u8)(v&0xFF);
-      v >>= 8;
-    }while( i );
-    return len;
-  }
+  u64 v;
+  u32 i;
 
   /* String or blob */
   if( serial_type>=12 ){
@@ -3351,8 +3333,18 @@ u32 sqlite3VdbeSerialPut(u8 *buf, Mem *pMem, u32 serial_type){
     return len;
   }
 
-  /* NULL or constants 0 or 1 */
-  return 0;
+  /* Integer and Real */
+  if( serial_type==7 ){
+    assert( sizeof(v)==sizeof(pMem->u.r) );
+    memcpy(&v, &pMem->u.r, sizeof(v));
+    swapMixedEndianFloat(v);
+  }else{
+    v = pMem->u.i;
+  }
+  len = i = sqlite3SmallTypeSizes[serial_type];
+  v = __builtin_bswap64(v);
+  memcpy(buf, &((char*)&v)[8-i], i);
+  return len;
 }
 
 /* Input "x" is a sequence of unsigned characters that represent a