-C Use\sa\snew\salgorithm\sfor\ssqlite3Strlen\sthat\sis\sslightly\sslower\sbut\sis\smore\nlike\sto\swork\son\sa\smixture\sof\s32-\sand\s64-bit\ssystems.\s\sTicket\s#3237,\s#3248.\s(CVS\s5471)
-D 2008-07-24T17:06:48
+C Reduce\sthe\ssize\sof\sthe\sparser\sallocation.\s\sAdd\sadditional\sinstrumentation\nto\smem2.\s\sspeed1*.test\suses\sscratch\smalloc.\s(CVS\s5472)
+D 2008-07-24T23:34:07
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 77ff156061bb870aa0a8b3d545c670d08070f7e6
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/malloc.c c4b525896b8c188dab98609180d13dbeeeb33a84
F src/md5.c 008216bbb5d34c6fbab5357aa68575ad8a31516a
F src/mem1.c 08f95af5095ba5d1fae17deb0ea186e8cdefd8fa
-F src/mem2.c 1e14a86d12dff279427cc52bb41ce5d80f138137
+F src/mem2.c 01726714af78c144b5f1f76338bd094deaab1789
F src/mem3.c c73e935d0b900abc51d5fa45f880937b062f4a9f
F src/mem4.c 6703adb1717b26d9d70a1c2586b4b7b7ffee7909
F src/mem5.c 0b0ba1c2a02d86eb812dea6debacee841e3856f7
F test/soak.test 3c317b3e55e1160731030c8e865d1858fab66fea
F test/softheap1.test 73ebd6e020d2954d965da2072baba5922fc8fb6a
F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5
-F test/speed1.test 22e1b27af0683ed44dcd2f93ed817a9c3e65084a
+F test/speed1.test cd5d9302f18946c18570e9ce6c736a5e283c8fcf
F test/speed1p.explain d841e650a04728b39e6740296b852dccdca9b2cb
-F test/speed1p.test 5f79987671f930a8aa651091c2952c1782b0df83
+F test/speed1p.test 1c932ff428cd7c26f0324a6ac59b16dfb2fd8efa
F test/speed2.test 53177056baf6556dcbdcf032bbdfc41c1aa74ded
F test/speed3.test e312d7e442a5047d730569fdae2ba99bc94e1a13
F test/speed4.test abc0ad3399dcf9703abed2fff8705e4f8e416715
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439
F tool/lemon.c 13e9c37ab9e0cc182cc10b93ac0e5270bbf472c8
-F tool/lempar.c 1a2caec816704bce9ebefeb4b46f54d6b2f8970e
+F tool/lempar.c 82ad5e30f2da013a13dc934e582b85916d456b50
F tool/memleak.awk 4e7690a51bf3ed757e611273d43fe3f65b510133
F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8
F tool/memleak3.tcl 7707006ee908cffff210c98158788d85bb3fcdbf
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 7455310931787ddc72d677ba6c471b67af9418a8
-R 2dc3c49d1cf459d9463d2096757fe3cd
+P cb1876d8dc102be74be98dd57ac14ee67be8e8e2
+R 71cb87040ca7c102d12bf7d55288c874
U drh
-Z 6ffb5de8a8a5e4cc894ca126c9cfb890
+Z 3828cdd4b6a6e072ef07f4672692577c
-cb1876d8dc102be74be98dd57ac14ee67be8e8e2
\ No newline at end of file
+599a9dea8fc97d0e7f09e67c9954de8cc1b8748e
\ No newline at end of file
** This file contains implementations of the low-level memory allocation
** routines specified in the sqlite3_mem_methods object.
**
-** $Id: mem2.c,v 1.35 2008/07/24 08:20:40 danielk1977 Exp $
+** $Id: mem2.c,v 1.36 2008/07/24 23:34:07 drh Exp $
*/
#include "sqliteInt.h"
/*
** Gather statistics on the sizes of memory allocations.
- ** sizeCnt[i] is the number of allocation attempts of i*8
+ ** nAlloc[i] is the number of allocation attempts of i*8
** bytes. i==NCSIZE is the number of allocation attempts for
** sizes more than NCSIZE*8 bytes.
*/
- int sizeCnt[NCSIZE];
+ int nAlloc[NCSIZE]; /* Total number of allocations */
+ int nCurrent[NCSIZE]; /* Current number of allocations */
+ int mxCurrent[NCSIZE]; /* Highwater mark for nCurrent */
} mem;
+
+/*
+** Adjust memory usage statistics
+*/
+static void adjustStats(int iSize, int increment){
+ int i = ((iSize+7)&~7)/8;
+ if( i>NCSIZE-1 ){
+ i = NCSIZE - 1;
+ }
+ if( increment>0 ){
+ mem.nAlloc[i]++;
+ mem.nCurrent[i]++;
+ if( mem.nCurrent[i]>mem.mxCurrent[i] ){
+ mem.mxCurrent[i] = mem.nCurrent[i];
+ }
+ }else{
+ mem.nCurrent[i]--;
+ assert( mem.nCurrent[i]>=0 );
+ }
+}
+
/*
** Given an allocation, find the MemBlockHdr for that allocation.
**
sqlite3_mutex_enter(mem.mutex);
assert( mem.disallow==0 );
nReserve = (nByte+7)&~7;
- if( nReserve/8>NCSIZE-1 ){
- mem.sizeCnt[NCSIZE-1]++;
- }else{
- mem.sizeCnt[nReserve/8]++;
- }
totalSize = nReserve + sizeof(*pHdr) + sizeof(int) +
mem.nBacktrace*sizeof(void*) + mem.nTitle;
p = malloc(totalSize);
memcpy(z, mem.zTitle, mem.nTitle);
}
pHdr->iSize = nByte;
+ adjustStats(nByte, +1);
pInt = (int*)&pHdr[1];
pInt[nReserve/sizeof(int)] = REARGUARD;
memset(pInt, 0x65, nReserve);
}
z = (char*)pBt;
z -= pHdr->nTitle;
+ adjustStats(pHdr->iSize, -1);
memset(z, 0x2b, sizeof(void*)*pHdr->nBacktraceSlots + sizeof(*pHdr) +
pHdr->iSize + sizeof(int) + pHdr->nTitle);
free(z);
}
fprintf(out, "COUNTS:\n");
for(i=0; i<NCSIZE-1; i++){
- if( mem.sizeCnt[i] ){
- fprintf(out, " %3d: %d\n", i*8+8, mem.sizeCnt[i]);
+ if( mem.nAlloc[i] ){
+ fprintf(out, " %5d: %10d %10d %10d\n",
+ i*8, mem.nAlloc[i], mem.nCurrent[i], mem.mxCurrent[i]);
}
}
- if( mem.sizeCnt[NCSIZE-1] ){
- fprintf(out, " >%3d: %d\n", NCSIZE*8, mem.sizeCnt[NCSIZE-1]);
+ if( mem.nAlloc[NCSIZE-1] ){
+ fprintf(out, " %5d: %10d %10d %10d\n",
+ NCSIZE*8-8, mem.nAlloc[NCSIZE-1],
+ mem.nCurrent[NCSIZE-1], mem.mxCurrent[NCSIZE-1]);
}
fclose(out);
}
int i;
int nTotal = 0;
for(i=0; i<NCSIZE; i++){
- nTotal += mem.sizeCnt[i];
+ nTotal += mem.nAlloc[i];
}
return nTotal;
}
# This file implements regression tests for SQLite library. The
# focus of this script is measuring executing speed.
#
-# $Id: speed1.test,v 1.5 2007/03/31 22:34:16 drh Exp $
+# $Id: speed1.test,v 1.6 2008/07/24 23:34:07 drh Exp $
#
+sqlite3_shutdown
+sqlite3_config_scratch 29000 1
set testdir [file dirname $argv0]
source $testdir/tester.tcl
speed_trial_init speed1
#
# This is a copy of speed1.test modified to user prepared statements.
#
-# $Id: speed1p.test,v 1.2 2008/04/03 19:40:59 drh Exp $
+# $Id: speed1p.test,v 1.3 2008/07/24 23:34:07 drh Exp $
#
+sqlite3_shutdown
+sqlite3_config_scratch 29000 1
set testdir [file dirname $argv0]
source $testdir/tester.tcl
speed_trial_init speed1
** It is sometimes called the "minor" token.
*/
struct yyStackEntry {
- int stateno; /* The state-number */
- int major; /* The major token value. This is the code
- ** number for the token at this stack level */
- YYMINORTYPE minor; /* The user-supplied minor token value. This
- ** is the value of the token */
+ YYACTIONTYPE stateno; /* The state-number */
+ YYCODETYPE major; /* The major token value. This is the code
+ ** number for the token at this stack level */
+ YYMINORTYPE minor; /* The user-supplied minor token value. This
+ ** is the value of the token */
};
typedef struct yyStackEntry yyStackEntry;