1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Performance optimization in sqlite3ExprAssignVarNumber().

FossilOrigin-Name: 5987ca1ff94ed3c1666f783bb15b16158aa7e1db
This commit is contained in:
drh
2017-01-31 03:52:34 +00:00
parent e7eeeb99f7
commit 18814dfb7e
3 changed files with 15 additions and 9 deletions

View File

@@ -967,7 +967,13 @@ void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr, u32 n){
/* Wildcard of the form "?nnn". Convert "nnn" to an integer and
** use it as the variable number */
i64 i;
int bOk = 0==sqlite3Atoi64(&z[1], &i, n-1, SQLITE_UTF8);
int bOk;
if( n==2 ){ /*OPTIMIZATION-IF-TRUE*/
i = z[1]-'0'; /* The common case of ?N for a single digit N */
bOk = 1;
}else{
bOk = 0==sqlite3Atoi64(&z[1], &i, n-1, SQLITE_UTF8);
}
x = (ynVar)i;
testcase( i==0 );
testcase( i==1 );