unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Re: quickly find all executables
       [not found]   ` <7ik7a6edaq.fsf@neoscale.com>
@ 2003-07-28 17:20     ` Kevin Rodgers
  2003-07-28 19:23       ` Kin Cho
  2003-07-28 20:16       ` Stefan Monnier
  0 siblings, 2 replies; 3+ messages in thread
From: Kevin Rodgers @ 2003-07-28 17:20 UTC (permalink / raw)


Kin Cho wrote:

> Eric Marsden <emarsden@laas.fr> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: quickly find all executables
  2003-07-28 17:20     ` quickly find all executables Kevin Rodgers
@ 2003-07-28 19:23       ` Kin Cho
  2003-07-28 20:16       ` Stefan Monnier
  1 sibling, 0 replies; 3+ messages in thread
From: Kin Cho @ 2003-07-28 19:23 UTC (permalink / raw)


> 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.

I was using eval-expression to run the code previously.  Now, putting the
same code in a file and byte-compiling it appear to speed up neither Eric's
version, nor your version.

-kin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: quickly find all executables
  2003-07-28 17:20     ` quickly find all executables Kevin Rodgers
  2003-07-28 19:23       ` Kin Cho
@ 2003-07-28 20:16       ` Stefan Monnier
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2003-07-28 20:16 UTC (permalink / raw)


>> 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.

The faster the CPU, the less you care about CPU speed as opposed to I/O.

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

Actually, the byte-compiler won't make any difference on Eric's code, where
as Kevin's code will probably benefit more, although I doubt the differences
will be noticeable since most of the time is probably spent in
`file-executable-p'.


        Stefan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-07-28 20:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <7iznj4wrb1.fsf@neoscale.com>
     [not found] ` <wzihe5bvtll.fsf@melbourne.laas.fr>
     [not found]   ` <7ik7a6edaq.fsf@neoscale.com>
2003-07-28 17:20     ` quickly find all executables Kevin Rodgers
2003-07-28 19:23       ` Kin Cho
2003-07-28 20:16       ` Stefan Monnier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).