Author: cgutman
Date: Sat Dec 10 04:20:39 2011
New Revision: 54632
URL:
http://svn.reactos.org/svn/reactos?rev=54632&view=rev
Log:
[USETUP]
- Cache the last data block and offset so we don't have to search from the start each
time
- This avoids needless swapping of cabinet data in and out of RAM
- File copy in text-mode setup on 32 MB RAM is down from 8 minutes to 20 seconds (in my
testing)
Modified:
trunk/reactos/base/setup/usetup/cabinet.c
trunk/reactos/base/setup/usetup/cabinet.h
Modified: trunk/reactos/base/setup/usetup/cabinet.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/cabinet.…
==============================================================================
--- trunk/reactos/base/setup/usetup/cabinet.c [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/cabinet.c [iso-8859-1] Sat Dec 10 04:20:39 2011
@@ -757,6 +757,12 @@
// FIXME: check for match against search criteria
if (Search->File != Prev)
{
+ if (Prev == NULL || Search->File->FolderIndex !=
Prev->FolderIndex)
+ {
+ Search->CFData = NULL;
+ Search->Offset = 0;
+ }
+
/* don't match the file we started with */
if (wcscmp(Search->Search, L"*") == 0)
{
@@ -1011,10 +1017,12 @@
ExtractHandler(Search->File, DestName);
}
- /* find the starting block of the file
- start with the first data block of the folder */
- CFData = (PCFDATA)(CabinetFolders[Search->File->FolderIndex].DataOffset +
FileBuffer);
- CurrentOffset = 0;
+ if (Search->CFData)
+ CFData = Search->CFData;
+ else
+ CFData = (PCFDATA)(CabinetFolders[Search->File->FolderIndex].DataOffset +
FileBuffer);
+
+ CurrentOffset = Search->Offset;
while (CurrentOffset + CFData->UncompSize <= Search->File->FileOffset)
{
/* walk the data blocks until we reach
@@ -1022,6 +1030,9 @@
CurrentOffset += CFData->UncompSize;
CFData = (PCFDATA)((char *)(CFData + 1) + DataReserved + CFData->CompSize);
}
+
+ Search->CFData = CFData;
+ Search->Offset = CurrentOffset;
/* now decompress and discard any data in
the block before the start of the file */
Modified: trunk/reactos/base/setup/usetup/cabinet.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/cabinet.…
==============================================================================
--- trunk/reactos/base/setup/usetup/cabinet.h [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/cabinet.h [iso-8859-1] Sat Dec 10 04:20:39 2011
@@ -108,6 +108,8 @@
WCHAR Cabinet[MAX_PATH];
USHORT Index;
PCFFILE File; // Pointer to current CFFILE
+ PCFDATA CFData;
+ ULONG Offset;
} CAB_SEARCH, *PCAB_SEARCH;