bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using mapfile is extreamly slow compared to oldfashinod ways to read


From: Matthew Woehlke
Subject: Re: using mapfile is extreamly slow compared to oldfashinod ways to read files
Date: Mon, 06 Apr 2009 10:44:06 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.21) Gecko/20090320 Fedora/2.0.0.21-1.fc10 Thunderbird/2.0.0.21 Mnenhy/0.7.5.0

Chet Ramey wrote:
I'm sure there are efficiency improvements possible in the bash indexed
array implementation, but sequentially accessing a data structure
optimized for space and sparse arrays is never going to be as fast as
a read-process loop, and that difference becomes more and more apparent
the larger the array.

Maybe bash should remember the last position to optimize accessing the next element?

There are also always hash tables, which are a bit more expensive in memory use, but would provide faster lookups (and I /really/ hope you're using a hash - or at least some kind of tree - and not a list for named-element arrays!).

--
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
--
Anyone who is capable of getting themselves made President should on no account be allowed to do the job. -- The Hitchhiker's Guide to the Galaxy (Douglas Adams)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]