]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Changes to sqlite3ScratchMalloc() that make the entire memory allocation
authordrh <drh@noemail.net>
Sat, 23 Aug 2014 19:04:55 +0000 (19:04 +0000)
committerdrh <drh@noemail.net>
Sat, 23 Aug 2014 19:04:55 +0000 (19:04 +0000)
interface a little faster and about 100 bytes smaller.

FossilOrigin-Name: f83daa16f65ef35062412e88c214852a4aeb3da2

manifest
manifest.uuid
src/malloc.c

index aa0c254b02106257202835632a2fb3c73f2ca121..91d323beb877ec1742c00e6826d900a5f6a5b442 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Make\sthe\simplementation\sof\sthe\ssqlite3_aggregate_context()\sinterface\sfaster\nfor\ssecond\san\ssubsequent\sinvocations.\s\sThis\shelps\sall\saggregate\sfunctions\sto\nperform\sbetter.
-D 2014-08-23T18:17:19.059
+C Changes\sto\ssqlite3ScratchMalloc()\sthat\smake\sthe\sentire\smemory\sallocation\ninterface\sa\slittle\sfaster\sand\sabout\s100\sbytes\ssmaller.
+D 2014-08-23T19:04:55.170
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 5eb79e334a5de69c87740edd56af6527dd219308
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -191,7 +191,7 @@ F src/legacy.c 87c92f4a08e2f70220e3b22a9c3b2482d36a134a
 F src/lempar.c cdf0a000315332fc9b50b62f3b5e22e080a0952b
 F src/loadext.c 31c2122b7dd05a179049bbf163fd4839f181cbab
 F src/main.c 900dd06e41d22795cbb23ab0240397f1e2901bf7
-F src/malloc.c 0a88a97fc5ae621ca9659d38b080e0b9ddbb80ad
+F src/malloc.c 7f26fcedc42b93bb49c4c12a77aa0d891182392e
 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
 F src/mem1.c c0c990fcaddff810ea277b4fb5d9138603dd5d4b
 F src/mem2.c dce31758da87ec2cfa52ba4c5df1aed6e07d8e8f
@@ -1188,7 +1188,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 0c0a603950c97837442d82886f947aab0acbd805
-R d4bdc3de1168bf2d862dde32e02d949b
+P 802148f3110462eac939d53ce08eb9a2f6aac739
+R f2effcc85284cd0fae163c222d4987e9
 U drh
-Z 5d66d6e81701eb9b183824f31680ac42
+Z d2f180c60ae7591aa14ffa4ab8835b4a
index 5b8e019c7e89e280a07952acaba13c715277fd71..233ca9412697638783723ccb7cc403f3d46452f3 100644 (file)
@@ -1 +1 @@
-802148f3110462eac939d53ce08eb9a2f6aac739
\ No newline at end of file
+f83daa16f65ef35062412e88c214852a4aeb3da2
\ No newline at end of file
index 9fb43039791af361f46ce8e8111148860a7f99b4..f3b317da5ffdd7eec1e0dd80ddc911b6020bcccd 100644 (file)
@@ -352,22 +352,20 @@ void *sqlite3ScratchMalloc(int n){
   assert( n>0 );
 
   sqlite3_mutex_enter(mem0.mutex);
+  sqlite3StatusSet(SQLITE_STATUS_SCRATCH_SIZE, n);
   if( mem0.nScratchFree && sqlite3GlobalConfig.szScratch>=n ){
     p = mem0.pScratchFree;
     mem0.pScratchFree = mem0.pScratchFree->pNext;
     mem0.nScratchFree--;
     sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_USED, 1);
-    sqlite3StatusSet(SQLITE_STATUS_SCRATCH_SIZE, n);
     sqlite3_mutex_leave(mem0.mutex);
   }else{
-    if( sqlite3GlobalConfig.bMemstat ){
-      sqlite3StatusSet(SQLITE_STATUS_SCRATCH_SIZE, n);
-      n = mallocWithAlarm(n, &p);
-      if( p ) sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_OVERFLOW, n);
-      sqlite3_mutex_leave(mem0.mutex);
-    }else{
+    sqlite3_mutex_leave(mem0.mutex);
+    p = sqlite3Malloc(n);
+    if( sqlite3GlobalConfig.bMemstat && p ){
+      sqlite3_mutex_enter(mem0.mutex);
+      sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_OVERFLOW, sqlite3MallocSize(p));
       sqlite3_mutex_leave(mem0.mutex);
-      p = sqlite3GlobalConfig.m.xMalloc(n);
     }
     sqlite3MemdebugSetType(p, MEMTYPE_SCRATCH);
   }