Small performance increase and size reduction for sqlite3ExprCompare().

This change also handles some corner cases without the need for ALWAYS().

FossilOrigin-Name: d814ba6effc7c5b021ff625b57371627f3ee326687c508da99f78bc164386b7e
This commit is contained in:
drh 2021-11-19 19:11:58 +00:00
parent d9137e3be0
commit a51e60079f
3 changed files with 17 additions and 15 deletions

View File

@ -1,5 +1,5 @@
C Fix\sa\sbenign\sdata\srace\sin\sos_unix.c\sthat\smight\strouble\stsan\sand\ssimilar\stools.
D 2021-11-19T14:02:43.242
C Small\sperformance\sincrease\sand\ssize\sreduction\sfor\ssqlite3ExprCompare().\nThis\schange\salso\shandles\ssome\scorner\scases\swithout\sthe\sneed\sfor\sALWAYS().
D 2021-11-19T19:11:58.858
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -502,7 +502,7 @@ F src/date.c fa928630fecf1d436cdc7a7a5c950c781709023ca782c21b7a43cc7361a9451e
F src/dbpage.c 8a01e865bf8bc6d7b1844b4314443a6436c07c3efe1d488ed89e81719047833a
F src/dbstat.c 861e08690fcb0f2ee1165eff0060ea8d4f3e2ea10f80dab7d32ad70443a6ff2d
F src/delete.c 0c151975fa99560767d7747f9b60543d0093d9f8b89f13d2d6058e9c83ad19e7
F src/expr.c 6c55bf2170ae882369d2b87ad93ea976b8afb12cecc37a3dd86bc31eed9d8232
F src/expr.c 89c4a225af2ccf5e7f1d53a70170c405036c63cc55130467e013ec9553261cb1
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 187b67af20c5795953a592832c5d985e4313fe503ebd8f95e3e9e9ad5a730bb5
F src/func.c 1cfb09d7ffca81238eccefdb0293e1f5b7cfebbd1816dfad5ec6024742a7496b
@ -1933,7 +1933,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 90b06b6f42918852cfb15258be462c6bed260c6a618b86fa9084bac72fa2f58f
R 05a833efc38b4a3220b81b2f3a5823e3
U dan
Z fc95c03200d563c04629cc3672f249c7
P 95806ac1dabe4598170061d903ae30f09bafac149ff6696963a7e056ac846cdb
R 0db7fc688bd69b655cfa0f3bed689f81
U drh
Z e3e9adffefbcbe1772add8e69eede097

View File

@ -1 +1 @@
95806ac1dabe4598170061d903ae30f09bafac149ff6696963a7e056ac846cdb
d814ba6effc7c5b021ff625b57371627f3ee326687c508da99f78bc164386b7e

View File

@ -5469,12 +5469,9 @@ int sqlite3ExprCompare(
}
return 2;
}
if( pA->op!=TK_COLUMN
&& pA->op!=TK_AGG_COLUMN
&& ALWAYS(!ExprHasProperty(pA, EP_IntValue))
&& pA->u.zToken
){
assert( !ExprHasProperty(pB, EP_IntValue) );
assert( !ExprHasProperty(pA, EP_IntValue) );
assert( !ExprHasProperty(pB, EP_IntValue) );
if( pA->u.zToken ){
if( pA->op==TK_FUNCTION || pA->op==TK_AGG_FUNCTION ){
if( sqlite3StrICmp(pA->u.zToken,pB->u.zToken)!=0 ) return 2;
#ifndef SQLITE_OMIT_WINDOWFUNC
@ -5492,7 +5489,12 @@ int sqlite3ExprCompare(
return 0;
}else if( pA->op==TK_COLLATE ){
if( sqlite3_stricmp(pA->u.zToken,pB->u.zToken)!=0 ) return 2;
}else if( ALWAYS(pB->u.zToken!=0) && strcmp(pA->u.zToken,pB->u.zToken)!=0 ){
}else
if( pB->u.zToken!=0
&& pA->op!=TK_COLUMN
&& pA->op!=TK_AGG_COLUMN
&& strcmp(pA->u.zToken,pB->u.zToken)!=0
){
return 2;
}
}