optimization ?

Chris Pressey cpressey@REDACTED
Tue Apr 22 22:14:12 CEST 2003


On Tue, 22 Apr 2003 10:34:29 +0200 (MEST)
Bengt Kleberg <eleberg@REDACTED> wrote:

> 
> > Date: Tue, 22 Apr 2003 01:09:11 -0500
> > From: Chris Pressey <cpressey@REDACTED>
> > Subject: Re: optimization ?
> ...deleted
> > expensive compared to a simple cons.  You might want to try
> > [T|Acc]...
> > 
> > > 	    end;	
> > > 	Other -> 
> > > 	    dirs(Top, Tail, Acc)
> > >     end;
> > > 
> > > dirs(_Top, [], Ack) -> Ack.
> > 
> > ...then lists:flatten/1 the result here before you return it, if you
> 
> are you sure?

Oops.  No, you're right, I forgot the list was of strings.
Flattening it doesn't make sense, and if you leave it deep it can
reflect the directory structure, which might be handy.

Anyway, it looks like the real culprit is file:read_link_info/1.

> i tried this (but might have made a mistake) and the result i got was
> 1 single (long) string.
> the original result, a list of strings, is much more readable.
> 
> 
> bengt

-Chris



More information about the erlang-questions mailing list