[GLLUG] Software Library Release
Thomas Hruska
thruska at cubiclesoft.com
Tue Feb 13 00:56:57 EST 2007
Bong Munoz wrote:
> On 2/12/07, Thomas Hruska <thruska at cubiclesoft.com> wrote:
>>
>> ... Finding
>> an entry requires scanning the linked list linearly, resulting in O(N^2)
>> load times (i.e. the bigger the config, the longer it takes to load).
>> Consider using a hash instead.
>>
>
> A configuration file where a linear search in C becomes significant should
> be massive. If grep can go through a 7Mb file in mere seconds an O(N)
> linear
> scan should be efficient enough. Besides, configuration data is usually
> only
> loaded once.
>
> --bong
grep and this library are unrelated in what they do. I'll grant you
that it would probably be a massive config where performance becomes an
issue, but if you have to equate the library to grep, it would be
similar to running grep for each entry in the config (minus the time it
took to start up grep's executable for each search). A program that
loads a configuration is going to want each and every value from that
configuration with defaults as a fallback position if an entry is
missing or invalid. So the entire config would be searched for each
entry until it was found...starting at the beginning. A way to
potentially speed up configuration loading while retaining the linked
list would be to delete each entry after it is found. This becomes
close to O(1) if the config is sorted the way the program expects the
options to appear in. Anyway, that was my last point in a list of
design issues and really didn't think it was all that important.
--
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197
*NEW* VerifyMyPC 2.0
Change tracking and management tool.
Reduce tech. support times from 2 hours to 5 minutes.
Free for personal use, $10 otherwise.
http://www.CubicleSoft.com/VerifyMyPC/
More information about the linux-user
mailing list