help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: quickly find all executables


From: Kevin Rodgers
Subject: Re: quickly find all executables
Date: Mon, 28 Jul 2003 11:20:55 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

Kin Cho wrote:

Eric Marsden <address@hidden> writes:

 (remove-if-not 'file-executable-p
    (mapcan (lambda (dir) (directory-files dir t))
            (remove-if-not 'file-directory-p exec-path)))


Thanks.  This code is significantly shorter than Kevin Rodgers'
version, and it runs in virtually the same amount of time for my
setup (ok, about .02 seconds slower to be exact).


Did you add in the time needed to load cl (a prerequisite for cl-seq
and cl-extra), cl-seq (for remove-if-not), and cl-extra (for mapcan)?

:-)


This is quite amazing to me -- I thought lambda's are function
calls, and function calls are slow, at least on a CISC CPU like
the P4 that I'm running on.


Lisp function calls are relatively slow, but you can't determine
how many functions are called just by looking at the code.

Also, did you try byte-compiling the code?  Eric's code would probably
benefit the most, because of the lambda form.

--
Kevin Rodgers



reply via email to

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