From d94b0556f84b2a9173d667e09a777fe860b5df94 Mon Sep 17 00:00:00 2001 From: shane Date: Tue, 30 Sep 2008 04:20:07 +0000 Subject: [PATCH] Misc clean up. Wrapped a CE only variable in if-defs. Changed to only provide cache hint for CE builds (as this prevents CE from compressing the file.) Performance testing on XP and Vista showed caching hint had little effect when the DB size was much smaller than the O/S disk cache size, and provided only marginal benefit when the DB size was much larger than the cache. On Vista, overall system performance was hurt for very large DBs. Ticket #3387. (CVS 5753) FossilOrigin-Name: 15dd0169a4c5e2ff9e3894eec10799cb89d462e5 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_win.c | 21 ++++++++++++--------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/manifest b/manifest index a53a9434ca..9466384151 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C A\sfew\sminor\schanges\sto\stest\sscripts\sso\sthat\sthey\swork\son\slinux-amd64.\s(CVS\s5752) -D 2008-09-30T00:31:38 +C Misc\sclean\sup.\s\sWrapped\sa\sCE\sonly\svariable\sin\sif-defs.\sChanged\sto\sonly\sprovide\scache\shint\sfor\sCE\sbuilds\s(as\sthis\sprevents\sCE\sfrom\scompressing\sthe\sfile.)\sPerformance\stesting\son\sXP\sand\sVista\sshowed\scaching\shint\shad\slittle\seffect\swhen\sthe\sDB\ssize\swas\smuch\ssmaller\sthan\sthe\sO/S\sdisk\scache\ssize,\sand\sprovided\sonly\smarginal\sbenefit\swhen\sthe\sDB\ssize\swas\smuch\slarger\sthan\sthe\scache.\s\sOn\sVista,\soverall\ssystem\sperformance\swas\shurt\sfor\svery\slarge\sDBs.\s\sTicket\s#3387.\s(CVS\s5753) +D 2008-09-30T04:20:08 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in e4ab842f9a64ef61d57093539a8aab76b12810db F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -136,7 +136,7 @@ F src/os.h ef8abeb9afc694b82dbd169a91c9b7e26db3c892 F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60 F src/os_os2.c e391fc95adc744bbdcefd4d11e3066998185a0a0 F src/os_unix.c f33b69d8a85372b270fe37ee664a4c2140a5217d -F src/os_win.c 3209dc0ed734291764393ea8d534ba0d8696a540 +F src/os_win.c 04033a86a39f49cb8e348f515eb0116aa9d36678 F src/pager.c 44eba010e81dcc9b772401b90d6a1c61ec24345b F src/pager.h 9c1917be28fff58118e1fe0ddbc7adfb8dd4f44d F src/parse.y d0f76d2cb8d6883d5600dc20beb961a6022b94b8 @@ -637,7 +637,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P 35e8e4dcd24b050b535ae005ca3b25e6a673eb89 -R 9074d4b98a3d572c308fa30be3a7f773 -U drh -Z fbd675315e0378308c18a28ef87a5133 +P 78d075ff38d96cc58659a7097dec0e49402aa960 +R 39be9f2940749141be589318f7d2a538 +U shane +Z b381b1aa9c52e2148aadad6fea9866f7 diff --git a/manifest.uuid b/manifest.uuid index 5f25a77906..192288f971 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -78d075ff38d96cc58659a7097dec0e49402aa960 \ No newline at end of file +15dd0169a4c5e2ff9e3894eec10799cb89d462e5 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index a143ffbf54..d9f195099f 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -12,7 +12,7 @@ ** ** This file contains code that is specific to windows. ** -** $Id: os_win.c,v 1.133 2008/09/01 22:15:19 shane Exp $ +** $Id: os_win.c,v 1.134 2008/09/30 04:20:08 shane Exp $ */ #include "sqliteInt.h" #if SQLITE_OS_WIN /* This file is used for windows only */ @@ -610,7 +610,7 @@ static int winClose(sqlite3_file *id){ OSTRACE2("CLOSE %d\n", pFile->h); do{ rc = CloseHandle(pFile->h); - }while( rc==0 && cnt++ < MX_CLOSE_ATTEMPT && (Sleep(100), 1) ); + }while( rc==0 && ++cnt < MX_CLOSE_ATTEMPT && (Sleep(100), 1) ); #if SQLITE_OS_WINCE #define WINCE_DELETION_ATTEMPTS 3 winceDestroyLock(pFile); @@ -1177,7 +1177,9 @@ static int winOpen( DWORD dwShareMode; DWORD dwCreationDisposition; DWORD dwFlagsAndAttributes = 0; - int isTemp; +#if SQLITE_OS_WINCE + int isTemp = 0; +#endif winFile *pFile = (winFile*)id; void *zConverted; /* Filename in OS encoding */ const char *zUtf8Name = zName; /* Filename in UTF-8 encoding */ @@ -1218,19 +1220,20 @@ static int winOpen( if( flags & SQLITE_OPEN_DELETEONCLOSE ){ #if SQLITE_OS_WINCE dwFlagsAndAttributes = FILE_ATTRIBUTE_HIDDEN; + isTemp = 1; #else dwFlagsAndAttributes = FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_HIDDEN | FILE_FLAG_DELETE_ON_CLOSE; #endif - isTemp = 1; }else{ dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL; - isTemp = 0; } /* Reports from the internet are that performance is always ** better if FILE_FLAG_RANDOM_ACCESS is used. Ticket #2699. */ +#if SQLITE_OS_WINCE dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS; +#endif if( isNT() ){ h = CreateFileW((WCHAR*)zConverted, dwDesiredAccess, @@ -1308,7 +1311,7 @@ static int winDelete( int syncDir /* Not used on win32 */ ){ int cnt = 0; - int rc; + DWORD rc; DWORD error; void *zConverted = convertUtf8Filename(zFilename); if( zConverted==0 ){ @@ -1320,19 +1323,19 @@ static int winDelete( DeleteFileW(zConverted); }while( ( ((rc = GetFileAttributesW(zConverted)) != INVALID_FILE_ATTRIBUTES) || ((error = GetLastError()) == ERROR_ACCESS_DENIED)) - && (cnt++ < MX_DELETION_ATTEMPTS) + && (++cnt < MX_DELETION_ATTEMPTS) && (Sleep(100), 1) ); }else{ do{ DeleteFileA(zConverted); }while( ( ((rc = GetFileAttributesA(zConverted)) != INVALID_FILE_ATTRIBUTES) || ((error = GetLastError()) == ERROR_ACCESS_DENIED)) - && (cnt++ < MX_DELETION_ATTEMPTS) + && (++cnt < MX_DELETION_ATTEMPTS) && (Sleep(100), 1) ); } free(zConverted); OSTRACE2("DELETE \"%s\"\n", zFilename); - return ( (rc==INVALID_FILE_ATTRIBUTES) + return ( (rc == INVALID_FILE_ATTRIBUTES) && (error == ERROR_FILE_NOT_FOUND)) ? SQLITE_OK : SQLITE_IOERR_DELETE; } -- 2.47.2