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

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

Re: [patch] 21.3 executable.find - Use cache in `executable-find'


From: Jari Aalto+mail.linux
Subject: Re: [patch] 21.3 executable.find - Use cache in `executable-find'
Date: Thu, 25 Mar 2004 11:14:03 +0200
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (windows-nt) (i386-msvc-nt5.0.2195)

* 2004-03-25 Eli Zaretskii <eliz <AT> elta.co.il> mail.default.spool
| > From: jari.aalto <AT> poboxes.com (Jari Aalto+mail.linux)
| > Date: Thu, 25 Mar 2004 00:24:10 +0200
| > 
| > | Any measurements to show that this indeed yields significant savings
| > | in Emacs?
| > 
| > No, but just common sense.
| 
| My common sense says ``profile before you optimize''.

But the results in this time are obvious. Cached path value is always
faster than doing directory searches. Disk I/O is always slower than
memory based search. Depending on how busy disk is, things are even
worse.

| > I have 50 directories in path and depending
| > just where the /bin might be it could take ages to find same programs
| > all again.
| 
| I'd like to know how long is ``ages''.  With today's caching OSes,
| you'd be surprised how fast that could be.
| 
| I could be wrong, of course, but only measurements will prove or
| disprove that.

See results above. I used slightly different Emacs version, because
Cygwin is the "non patched" and Native NT Emacs is "patched" and
I don't have an easy way to make NTEmacs "unpatched". 

It suprised, that NTEmacs were even slower - I though it would have
been the other way round.

Every time program is called the "search time" is added. Now if the
program is called in a loop, that will even more make it slower (those
cases are rare I believe).

But anyway, it does improve things.
Jari

Emacs 21.3 / Win32 native, caching active

time: 90000 microseconds                << First search, without cache
time: 0 microseconds                    << now cached.
time: 0 microseconds
time: 0 microseconds
time: 0 microseconds
time: 0 microseconds
time: 0 microseconds
time: 0 microseconds
time: 0 microseconds
time: 0 microseconds

Emacs 21.3 / Win32 Cygwin version, no caching
 
time: 13000 microseconds
time: 14000 microseconds
time: 13000 microseconds
time: 14000 microseconds
time: 13000 microseconds
time: 36000 microseconds
time: 14000 microseconds
time: 14000 microseconds
time: 14000 microseconds
time: 15000 microseconds


Test case:

(let ((exec-path exec-path)
      a
      b 
      list)
  (dotimes (x 40)
    (push "/this/dummy" list))
  (append list exec-path)
  (dotimes (x 10)
    (setq a (current-time))
    (executable-find "ls")
    (setq b (current-time))
    (sit-for 0.3)
    (insert
     (format "\ntime: %s microseconds"
             (- (caddr b) (caddr a))))))


-- 
http://tiny-tools.sourceforge.net/
Swatch @time   http://www.mir.com.my/iTime/itime.htm
               http://www.ryanthiessen.com/swatch/resources.htm
Use Licenses!  http://www.linuxjournal.com/article.php?sid=6225
Which Licence? http://www.linuxjournal.com/article.php?sid=4825
OSI Licences   http://www.opensource.org/licenses/





reply via email to

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