Hello Nello,
I  have  been  considering  the  code  required  to  do  this  and it will be an
interesting  exercise to compare the two search types; using an integer index as
you  suggest and the case statement which I suspect is applying an array type of
search as well.
BTW each event of the search is for one filename; there is not a lot
of files in one go. The parameters are to parse a file OK to decompress then
 action appropriately, then step to the next compressed file.
Thanks all.
Al+



Tuesday, October 15, 2002, 2:11:46 PM, you wrote:
NS> if by "filetype" you mean a 3 byte extension (like .pas or .txt)
NS> and you can constrain the character set (say to case-indifferent
NS> alpha, digits and a few special characters like '$' and ' ' and
NS> '_') then you have about 40^3 (about 65k)  possible file types.

NS> you could comfortably hold an array of 65k byte codes for
NS> "include/exclude/whatever" and map each 3byte filetype directly
NS> to an integer index into this array.

NS> BTW you can use a similar trick to quickly generate the
NS> index into the table from the 3 byte filetype: construct
NS> 3 tables of 256 integers (1 for each possible character in each
NS> of the 3 positions 1,2,3 of the filetype) - then sum those integers
NS> to create the index into the 65k array.

NS> if you have a lot of filetypes this will be faster than doing
NS> searching lookups into a table of 65000 codes.



NS> -ns
NS> http://www.roserox.co.th


NS> ----- Original Message -----
NS> From: "Alistair George" <[EMAIL PROTECTED]>
NS> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
NS> Sent: Tuesday, October 15, 2002 07:02
NS> Subject: [DUG]: To CASE or not?


>> Hi all.
>> I am writing a backup routine which includes or excludes bunches of
>> files/folders.
>> For example, during the backup process the compressor must be told which
NS> file
>> types to exclude.
>> My concern is that if this bunch of types is numerous that the
>> processing/parsing could be quite resource intensive.
>>
>> Any suggestions to achieve this would be appreciated. My own feeling is to
NS> run
>> with a dynamic CASE statement, but even this would seem to take a pretty
NS> big
>> chunk of processing time given each file is parsed?
>> Thanks,
>> Alistair George+
>>
>> --------------------------------------------------------------------------
NS> -
>>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>>                   Website: http://www.delphi.org.nz
>> To UnSub, send email to: [EMAIL PROTECTED]
>> with body of "unsubscribe delphi"
>> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

NS> ---------------------------------------------------------------------------
NS>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
NS>                   Website: http://www.delphi.org.nz
NS> To UnSub, send email to: [EMAIL PROTECTED] 
NS> with body of "unsubscribe delphi"
NS> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/


-- 
Regards,
 Alistair+

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to