Markus Neteler 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? :)
I had overlooked the part where loop which adds the separator was replaced with a call to "tr". Technically, this corresponds to a reduction in functionality, as the previous version would accept any string as a separator, but using "tr" restricts it to a single character (which is probably all that's required). I've committed an update which has no loops other than the top-level "for mapset in $mapsets" loop. -- Glynn Clements <[EMAIL PROTECTED]> _______________________________________________ grass-dev mailing list [email protected] http://grass.itc.it/mailman/listinfo/grass-dev

