From: drh Date: Mon, 25 Oct 2004 20:33:44 +0000 (+0000) Subject: Minor optimizations in the pragma module. (CVS 2029) X-Git-Tag: version-3.1.0~228 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=722e95ac65d681835cb1477027147532126e8651;p=thirdparty%2Fsqlite.git Minor optimizations in the pragma module. (CVS 2029) FossilOrigin-Name: 63efd50a1608eb4ccac44a233c0f77c3956f9fa0 --- diff --git a/manifest b/manifest index 147f1b1641..5f4e35ecc7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Tighter\sencoding\sof\sthe\skeyword\shash\stable\sin\sthe\stokenizer.\s(CVS\s2028) -D 2004-10-23T05:10:18 +C Minor\soptimizations\sin\sthe\spragma\smodule.\s(CVS\s2029) +D 2004-10-25T20:33:44 F Makefile.in 52c1cc106cad9148d4b7cb387b458e82dc86b339 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1 @@ -20,7 +20,7 @@ F ltmain.sh f6b283068efa69f06eb8aa1fe4bddfdbdeb35826 F main.mk bf65bb9f839aa8777796c9846816be590a7cd4b0 F mkdll.sh 468d4f41d3ea98221371df4825cfbffbaac4d7e4 F mkopcodec.awk 80311cdeb16d78017cc62e4ad6c6d008e5fe0e17 -F mkopcodeh.awk 877459a51b4c75a99d7336159790aca51e4c2cad +F mkopcodeh.awk 4090944e4de0a2ccb99aa0083290f73bce4db406 F mkso.sh 7b67da1d63070875ba948e749aee9ef50ce36e3d F publish.sh 72bde067dda3fc2d33e92f20253b924e3b97da30 F spec.template b2f6c4e488cbc3b993a57deba22cbc36203c4da3 @@ -56,7 +56,7 @@ F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b F src/pager.c cc2e7fb3d7913862d7b1170f923d2dcfdbac3bed F src/pager.h 774d1973acbda341827d21b0da0150575d69f7d9 F src/parse.y 8d97a91cba7e35b5eaac064c9f6e597dc6442b29 -F src/pragma.c 2b65e0150ca1af8041c3db95e7b1c41dc51a3e95 +F src/pragma.c 263e20f7640df1e7937f1c71372fa286356aaf09 F src/printf.c 7a92adc00b758cd5ce087dae80181a8bbdb70ed2 F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3 F src/select.c de51ec24aef0d5370819dac6c2613460effac42c @@ -252,7 +252,7 @@ F www/tclsqlite.tcl 560ecd6a916b320e59f2917317398f3d59b7cc25 F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0 F www/whentouse.tcl fdacb0ba2d39831e8a6240d05a490026ad4c4e4c -P 39f7870a54d90d5163fcad3f08cd63699c4bb567 -R f3fcd5be76f79a1c63d8d5fffbad49dd +P 7b9886f8d4db366bc7dbf25495f0d3b907d25689 +R e866ede2f03d84f2dce38e1442866c10 U drh -Z 91960f90f1e7a02a6b795447e3b7377d +Z 5a8b8e324cda1249d7cb76835accaa40 diff --git a/manifest.uuid b/manifest.uuid index 836ed52f45..e7ace73758 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7b9886f8d4db366bc7dbf25495f0d3b907d25689 \ No newline at end of file +63efd50a1608eb4ccac44a233c0f77c3956f9fa0 \ No newline at end of file diff --git a/mkopcodeh.awk b/mkopcodeh.awk index ead07d5ff9..44a12cc242 100644 --- a/mkopcodeh.awk +++ b/mkopcodeh.awk @@ -1,5 +1,7 @@ #!/usr/bin/awk -f # +# Generate the file opcodes.h. +# # This AWK script scans a concatenation of the parse.h output file from the # parser and the vdbe.c source file in order to generate the opcodes numbers # for all opcodes. @@ -12,6 +14,15 @@ # the OP_ is the same as the TK_ value. If missing, the OP_ value is assigned # a small integer that is different from every other OP_ value. # +# We go to the trouble of making some OP_ value the same as TK_ values +# as an optimization. During parsing, things like expression operators +# are coded with TK_ values such as TK_ADD, TK_DIVIDE, and so forth. Later +# during code generation, we need to generate corresponding opcodes like +# OP_Add and OP_Divide. By making TK_ADD==OP_Add and TK_DIVIDE==OP_Divide, +# code to translation from one to the other is avoided. This makes the +# code generator run (infinitesimally) faster and more importantly it makes +# the total library smaller. +# # Remember the TK_ values from the parse.h file /^#define TK_/ { diff --git a/src/pragma.c b/src/pragma.c index dbe00f70cd..d238d4264f 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code used to implement the PRAGMA command. ** -** $Id: pragma.c,v 1.71 2004/10/22 20:29:22 drh Exp $ +** $Id: pragma.c,v 1.72 2004/10/25 20:33:44 drh Exp $ */ #include "sqliteInt.h" #include @@ -21,22 +21,6 @@ # include "btree.h" #endif -/* -** Interpret the given string as a boolean value. -*/ -static int getBoolean(const u8 *z){ - static const u8 *azTrue[] = { "yes", "on", "true" }; - int i; - if( z[0]==0 ) return 0; - if( sqlite3IsNumber(z, 0, SQLITE_UTF8) ){ - return atoi(z); - } - for(i=0; iflags value */ } aPragma[] = { @@ -141,24 +127,24 @@ static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){ { "short_column_names", SQLITE_ShortColNames }, { "count_changes", SQLITE_CountRows }, { "empty_result_callbacks", SQLITE_NullCallback }, -/* The following is VERY experimental */ + /* The following is VERY experimental */ { "writable_schema", SQLITE_WriteSchema }, }; int i; - for(i=0; izName)==0 ){ sqlite3 *db = pParse->db; Vdbe *v; if( zRight==0 ){ v = sqlite3GetVdbe(pParse); if( v ){ - returnSingleInt(pParse, - aPragma[i].zName, (db->flags&aPragma[i].mask)!=0); + returnSingleInt(pParse, p->zName, (db->flags & p->mask)!=0 ); } }else if( getBoolean(zRight) ){ - db->flags |= aPragma[i].mask; + db->flags |= p->mask; }else{ - db->flags &= ~aPragma[i].mask; + db->flags &= ~p->mask; } return 1; }