]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Slightly smaller and faster implementation for vdbeSorterCompareInt().
authordrh <drh@noemail.net>
Mon, 3 Apr 2017 12:04:39 +0000 (12:04 +0000)
committerdrh <drh@noemail.net>
Mon, 3 Apr 2017 12:04:39 +0000 (12:04 +0000)
FossilOrigin-Name: 84fa069c5bdfe41d03d03875c9157cc6785150b677c04e40b8916ba5af073dc8

manifest
manifest.uuid
src/vdbesort.c

index 78dd3266f7a062528e96a7ea64a79d0f3aaec6c4..aa94d46525aa4ad625f885ab128d963159dbb545 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Remove\san\sunnecessary\ssetting\sof\sthe\sMem.enc\sfield\sfor\sthe\soutput\sof\sthe\nOP_Record\sopcode,\sfor\sa\sperformance\simprovement\sand\ssize\sreduction.
-D 2017-04-01T20:44:26.383
+C Slightly\ssmaller\sand\sfaster\simplementation\sfor\svdbeSorterCompareInt().
+D 2017-04-03T12:04:39.935
 F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc a4c0613a18663bda56d8cf76079ab6590a7c3602e54befb4bbdef76bcaa38b6a
@@ -475,7 +475,7 @@ F src/vdbeapi.c 5b08d82592bcff4470601fe78aaabebd50837860
 F src/vdbeaux.c 514eb1749346b1e587fbeb775198ed9385476d5639bc81aef42914e2fe70962d
 F src/vdbeblob.c 359891617358deefc85bef7bcf787fa6b77facb9
 F src/vdbemem.c bbd8f5fdb7f11e02d9a6201f18a52325f1d2361a2850ff03a38f8efa5188f2dc
-F src/vdbesort.c eda25cb2d1727efca6f7862fea32b8aa33c0face
+F src/vdbesort.c e72fe02a2121386ba767ede8942e9450878b8fc873abf3d1b6824485f092570c
 F src/vdbetrace.c 41963d5376f0349842b5fc4aaaaacd7d9cdc0834
 F src/vtab.c 007513c2ef52472fcdea6a741683d50662e82790
 F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
@@ -1569,7 +1569,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P c45cd3b947c0f03a688f827fddb4629a986788f0dd98d5ef899f11e68ff1c202
-R 9110f45f53ee5a3c301af47a0be3a540
+P e6e36b288fdf21b7ff7f0bf85d2225b6505f54367b183c302c93c34a4a40b8b5
+R d96ebce90865dec08afc476da7f545eb
 U drh
-Z db07b81eed986b15417f2526357a7c90
+Z ac1b2d769355137cbadf1703484266cb
index af50b4417df8747d4249547670031395b8ed7615..35356ca02e0fbf6c7731534ee4909ab99a8cfd37 100644 (file)
@@ -1 +1 @@
-e6e36b288fdf21b7ff7f0bf85d2225b6505f54367b183c302c93c34a4a40b8b5
\ No newline at end of file
+84fa069c5bdfe41d03d03875c9157cc6785150b677c04e40b8916ba5af073dc8
\ No newline at end of file
index 631fb19616f2dd4b2b08c7a4d0d3cd0156706690..7dbb1b063f8cc48703815329f5a5f5172c185eff 100644 (file)
@@ -858,37 +858,36 @@ static int vdbeSorterCompareInt(
   assert( (s1>0 && s1<7) || s1==8 || s1==9 );
   assert( (s2>0 && s2<7) || s2==8 || s2==9 );
 
-  if( s1>7 && s2>7 ){
-    res = s1 - s2;
-  }else{
-    if( s1==s2 ){
-      if( (*v1 ^ *v2) & 0x80 ){
-        /* The two values have different signs */
-        res = (*v1 & 0x80) ? -1 : +1;
-      }else{
-        /* The two values have the same sign. Compare using memcmp(). */
-        static const u8 aLen[] = {0, 1, 2, 3, 4, 6, 8 };
-        int i;
-        res = 0;
-        for(i=0; i<aLen[s1]; i++){
-          if( (res = v1[i] - v2[i]) ) break;
+  if( s1==s2 ){
+    /* The two values have the same sign. Compare using memcmp(). */
+    static const u8 aLen[] = {0, 1, 2, 3, 4, 6, 8, 0, 0, 0 };
+    const u8 n = aLen[s1];
+    int i;
+    res = 0;
+    for(i=0; i<n; i++){
+      if( (res = v1[i] - v2[i])!=0 ){
+        if( ((v1[0] ^ v2[0]) & 0x80)!=0 ){
+          res = v1[0] & 0x80 ? -1 : +1;
         }
+        break;
       }
+    }
+  }else if( s1>7 && s2>7 ){
+    res = s1 - s2;
+  }else{
+    if( s2>7 ){
+      res = +1;
+    }else if( s1>7 ){
+      res = -1;
     }else{
-      if( s2>7 ){
-        res = +1;
-      }else if( s1>7 ){
-        res = -1;
-      }else{
-        res = s1 - s2;
-      }
-      assert( res!=0 );
+      res = s1 - s2;
+    }
+    assert( res!=0 );
 
-      if( res>0 ){
-        if( *v1 & 0x80 ) res = -1;
-      }else{
-        if( *v2 & 0x80 ) res = +1;
-      }
+    if( res>0 ){
+      if( *v1 & 0x80 ) res = -1;
+    }else{
+      if( *v2 & 0x80 ) res = +1;
     }
   }