Re:Newbie - Sorting Files
Quote
"Kevin Hourihane" <khourih...@hotmail.com> wrote in message
news:9bi6pc$a9k$1@bob.news.rcn.net...
Quote
> Thanks for the reply, Bruce. You're understanding is correct - there are
> approx 70,000 files that need loading and sorting.
> I'd really like utilize a dynamic array of records to avoid having to
> distribute & maintain a physical database, but target workstation platform
> and resources vary greatly per installation (i.e., sometimes may be Win98
PC
> with 32MB RAM other times may be WinNT with 512MB RAM).
> I have no real world experience implementing large arrays of records so I
> don't have a clue as how to go about determining the memory requirements
> short of building the app and then taking before, during and after memory
> measurements. Does design standard or general rule of thumb exist that
could
> be used?
As a rough rule of thumb use the size of the record * the number of entries.
For the record size simply sum the size of each field, using 4 bytes for
each string field. Then add the "average" expected length of each of the
string fields. (I usually then round it up to the nearest power of 2.) Its
rough but will give you a fairly good working number.
If you are going to use a dynamic array instead of a tList, give some
thought to sorting pointers to the entries rather than the entries
themselves. As fast as machines are these days moving all that data around
will still take a measurable amount of time.
Something else you might consider is using an in-memory table. Some versions
of Delphi support this as do many databases, including DBISAM, and there are
a number of 3rd party components that provide the functionality.
One thing that I do wonder about is how static is the data. If a significant
number of the files that have to be processed will be around across several
runs then you really should give serious thought to maintaining a
non-volatile table and simply update it on each run. This could
significantly improve the performance of your app.