[GRASS-dev] g.mlist as C implementation?

Markus Neteler neteler at itc.it
Wed Sep 12 07:27:23 EDT 2007


Glynn Clements wrote on 09/10/2007 08:25 PM:
> Hamish wrote:
>
>   
>> Glynn Clements wrote:
>>     
>>> Markus Neteler wrote:
>>>       
>>>> when using g.mlist in mapsets with thousands of maps in
>>>> it (as happens with MODIS time series), it gets extremely
>>>> slow.
>>>>         
>> ..
>> Glynn Clements wrote:
>>     
>>> The main thing which stands out is that it invokes "grep" once for
>>> every name returned by g.list:
>>>       
>> see attached patch for consideration. Following Glynn's suggestion it
>> gets rid of the loop for each map name, making the script ~50% faster
>> than before, but still about twice as slow as a single call to g.list.
>>     
>
> Here's my proposed alternative. It avoids the use of backticks in
> favour of a pipeline ending in a while loop.
>
>   
It appears that Hamish's implementation based on Glynn's former notes
is much faster:

time sh g.mlist_glynn type=rast map=neteler pat="map*"
real    0m1.200s
user    0m0.749s
sys     0m0.464s

time sh g.mlist_hamish type=rast map=neteler pat="map*"
real    0m0.338s
user    0m0.190s
sys     0m0.052s

Is that the contribution to portability? :)

Markus


------------------
ITC -> dall'1 marzo 2007 Fondazione Bruno Kessler
ITC -> since 1 March 2007 Fondazione Bruno Kessler
------------------




More information about the grass-dev mailing list