From: drh Date: Sun, 24 Nov 2013 00:46:00 +0000 (+0000) Subject: The MEMSYS5 algorithm does not have to return the block with the lowest X-Git-Tag: version-3.8.2~46 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0c2df17691eec11caa198099ac067f4c8dda840a;p=thirdparty%2Fsqlite.git The MEMSYS5 algorithm does not have to return the block with the lowest address. Any block of the appropriate size will do. Use the first block found on the freelist for the appropriate size for a performance improvement. FossilOrigin-Name: 12e612e8e7c4a6f83acf0daf5608151fb5ec1575 --- 0c2df17691eec11caa198099ac067f4c8dda840a diff --cc manifest index 47369b1136,3c26785d5b..a96cf2f323 --- a/manifest +++ b/manifest @@@ -1,5 -1,5 +1,5 @@@ - C Add\snewlines\sat\sthe\send\sof\ssome\serror\smessages\sin\sspeedtest1. - D 2013-11-23T21:29:07.429 -C A\smuch\ssimpler\sfix\sis\sto\ssimply\schange\sMEMSYS5\sso\sthat\sit\stakes\sany\sfree\nblock\sof\sthe\sappropriate\ssize\s(the\sfirst\son\sthe\slist\sof\sfree\sblocks)\srather\nthan\ssearching\sfor\sthe\sone\swith\sthe\ssmallest\saddress.\s\sThis\sis\salso\sfaster\nthan\susing\sthe\smin-heap\salgorithm.\s\sNeed\sto\sresearch\sto\sverify\sthat\sthe\nallocator\sstill\ssatisfies\sthe\sRobson\sproof,\showever. -D 2013-11-23T22:45:12.906 ++C The\sMEMSYS5\salgorithm\sdoes\snot\shave\sto\sreturn\sthe\sblock\swith\sthe\slowest\naddress.\s\sAny\sblock\sof\sthe\sappropriate\ssize\swill\sdo.\s\sUse\sthe\sfirst\sblock\nfound\son\sthe\sfreelist\sfor\sthe\sappropriate\ssize\sfor\sa\sperformance\simprovement. ++D 2013-11-24T00:46:00.452 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in e1a9b4258bbde53f5636f4e238c65b7e11459e2b F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@@ -194,7 -194,7 +194,7 @@@ F src/mem0.c 6a55ebe57c46ca1a7d98da93aa F src/mem1.c c0c990fcaddff810ea277b4fb5d9138603dd5d4b F src/mem2.c dce31758da87ec2cfa52ba4c5df1aed6e07d8e8f F src/mem3.c 61c9d47b792908c532ca3a62b999cf21795c6534 - F src/mem5.c 0025308a93838022bd5696cf9627ff4e40b19918 -F src/mem5.c 77a525e6a4f623d1008f08a0a4050789e710d71e ++F src/mem5.c 2221f7e4619619d2df16fcb8a1da2a165ae56d9d F src/memjournal.c 0683aac6cab6ec2b5374c0db37c0deb2436a3785 F src/mutex.c d3b66a569368015e0fcb1ac15f81c119f504d3bc F src/mutex.h 5bc526e19dccc412b7ff04642f6fdad3fdfdabea @@@ -1142,7 -1142,10 +1142,8 @@@ F tool/vdbe-compress.tcl f12c884766bd14 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff - P 659f1a98ae698d062269f8fdac84f733a460f5de - R 0d67753f14410df579db17c64fb3786e -P 6b98f0af7a6522873245d30598d7c79b8aeb9fa0 -R e84ccd96a2888616670da3469dc947a5 -T *branch * memsys5-performance -T *sym-memsys5-performance * -T -sym-trunk * ++P 6b98f0af7a6522873245d30598d7c79b8aeb9fa0 8191b512122c13d7fa61d8e5487652f13ec172f7 ++R c70b3f80a0897046826a17fb7011539e ++T +closed 8191b512122c13d7fa61d8e5487652f13ec172f7 U drh - Z 430a11d968198395db1db68b7169dc35 -Z 93975e1a1bc297cea7284502171ff001 ++Z dce60b90fb1ae6b64b6c8216e4da2c33 diff --cc manifest.uuid index fe94011755,a79b866a19..648e8522b0 --- a/manifest.uuid +++ b/manifest.uuid @@@ -1,1 -1,1 +1,1 @@@ - 6b98f0af7a6522873245d30598d7c79b8aeb9fa0 -8191b512122c13d7fa61d8e5487652f13ec172f7 ++12e612e8e7c4a6f83acf0daf5608151fb5ec1575 diff --cc src/mem5.c index 5f99ebf43d,35719031f8..3870e91488 --- a/src/mem5.c +++ b/src/mem5.c @@@ -209,25 -209,29 +209,6 @@@ static int memsys5Size(void *p) return iSize; } --/* --** Find the first entry on the freelist iLogsize. Unlink that --** entry and return its index. --*/ --static int memsys5UnlinkFirst(int iLogsize){ - int i; -- int iFirst; -- -- assert( iLogsize>=0 && iLogsize<=LOGMAX ); - i = iFirst = mem5.aiFreelist[iLogsize]; - assert( iFirst>=0 ); - while( i>0 ){ - if( inext; - iFirst = mem5.aiFreelist[iLogsize]; -#if 0 - { - int i = iFirst; - assert( iFirst>=0 ); - while( i>0 ){ - if( inext; - } -- } -#endif -- memsys5Unlink(iFirst, iLogsize); -- return iFirst; --} -- /* ** Return a block of memory of at least nBytes in size. ** Return NULL if unable. Return NULL if nBytes==0. @@@ -273,7 -277,7 +254,8 @@@ static void *memsys5MallocUnsafe(int nB sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes", nByte); return 0; } -- i = memsys5UnlinkFirst(iBin); ++ i = mem5.aiFreelist[iBin]; ++ memsys5Unlink(i, iBin); while( iBin>iLogsize ){ int newSize;