From: drh Date: Fri, 8 Feb 2019 15:59:20 +0000 (+0000) Subject: Change the sqlite3VdbeMemGrow() routine so that it no longer guarantees a X-Git-Tag: version-3.28.0~197 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6ff7427733cb13ad1a9d09f9380f0bb646e26c4f;p=thirdparty%2Fsqlite.git Change the sqlite3VdbeMemGrow() routine so that it no longer guarantees a minimum size of 32 bytes. That minimum is no longer required, and without the extra check for the minimum size, the routine runs faster. FossilOrigin-Name: 5c499da8a4d0babc56883aa362ae124772fd9214a51169a88a5dee523d051658 --- diff --git a/manifest b/manifest index 7b191284e8..d01e8c1192 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Give\sthe\ssqlite3\sobject\sa\spointer\sto\sthe\scurrent\sParse\sso\sthat\sif\san\sOOM\noccurs,\sit\scan\sautomatically\sset\sthe\sParse.rc\svalue\sto\sSQLITE_NOMEM.\s\sThis\navoids\sa\sfrequent\sextra\stest\sof\sdb.mallocFailed\sin\sthe\sinnermost\sparser\sloop. -D 2019-02-08T14:55:30.490 +C Change\sthe\ssqlite3VdbeMemGrow()\sroutine\sso\sthat\sit\sno\slonger\sguarantees\sa\nminimum\ssize\sof\s32\sbytes.\s\sThat\sminimum\sis\sno\slonger\srequired,\sand\swithout\nthe\sextra\scheck\sfor\sthe\sminimum\ssize,\sthe\sroutine\sruns\sfaster. +D 2019-02-08T15:59:20.543 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in 178d8eb6840771149cee40b322d1b3be30d330198c522c903c1b66fb5a1bfca4 @@ -591,7 +591,7 @@ F src/vdbeInt.h a76d5eed62c76bcd8de7afd3147fac1bc40c5a870582664bcd7d071ef437c37f F src/vdbeapi.c 57a2d794a8833f269b878dbc24e955369bdb379af6c4e93ebc5ce1a20fa3daf4 F src/vdbeaux.c 4fa28b32452f6197dba7c8780dde11576b9a6d8ce6f35adbb69efc3e7d37fa0c F src/vdbeblob.c f5c70f973ea3a9e915d1693278a5f890dc78594300cf4d54e64f2b0917c94191 -F src/vdbemem.c 3173f0275cf8643a03ed02084ee56b97fc1a17a2edb5907facec504f59c3172d +F src/vdbemem.c 8facf8d2470af0b8f5995b405b7e061435b58ac53350fddd5e5399adfa904b73 F src/vdbesort.c 90aad5a92608f2dd771c96749beabdb562c9d881131a860a7a5bccf66dc3be7f F src/vdbetrace.c 79d6dbbc479267b255a7de8080eee6e729928a0ef93ed9b0bfa5618875b48392 F src/vtab.c 2462b7d6fd72b0b916477f5ef210ee49ab58cec195483ebdac0c8c5e3ec42cab @@ -1804,7 +1804,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 440a7cda000164d3b46109caf2e1dde80681ba9b0d94ba9be6847d2b917445cf -R d896d8bd0769798bd0ceee3ae07599f8 +P 5c6638040b3017c6be016441422d965a3ca00dd6ae1f78cadc0b54562978f64e +R fcc87fb69789bc1e53d9d02a501d47e6 U drh -Z 9fd176c740cfae5da5074aab30ee1252 +Z 16cd16f85b68b2c2cfa22d11f08d6b4d diff --git a/manifest.uuid b/manifest.uuid index 48f2b4598d..837c9fcb78 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5c6638040b3017c6be016441422d965a3ca00dd6ae1f78cadc0b54562978f64e \ No newline at end of file +5c499da8a4d0babc56883aa362ae124772fd9214a51169a88a5dee523d051658 \ No newline at end of file diff --git a/src/vdbemem.c b/src/vdbemem.c index 5aa0ec6ca5..e4cea0ff68 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -178,8 +178,7 @@ int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){ } /* -** Make sure pMem->z points to a writable allocation of at least -** min(n,32) bytes. +** Make sure pMem->z points to a writable allocation of at least n bytes. ** ** If the bPreserve argument is true, then copy of the content of ** pMem->z into the new allocation. pMem must be either a string or @@ -198,7 +197,6 @@ SQLITE_NOINLINE int sqlite3VdbeMemGrow(Mem *pMem, int n, int bPreserve){ assert( pMem->szMalloc==0 || pMem->szMalloc==sqlite3DbMallocSize(pMem->db, pMem->zMalloc) ); - if( n<32 ) n = 32; if( pMem->szMalloc>0 && bPreserve && pMem->z==pMem->zMalloc ){ pMem->z = pMem->zMalloc = sqlite3DbReallocOrFree(pMem->db, pMem->z, n); bPreserve = 0;