unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: jari.aalto@poboxes.com (Jari Aalto+mail.linux)
Cc: bug-gnu-emacs@gnu.org
Subject: Re: [patch] 21.3 executable.find - Use cache in `executable-find'
Date: Thu, 25 Mar 2004 11:14:03 +0200	[thread overview]
Message-ID: <k71947c4.fsf@blue.sea.net> (raw)
In-Reply-To: <ubrmlwhe2.fsf@elta.co.il> (Eli Zaretskii's message of "25 Mar 2004 08:49:25 +0200")

* 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	other threads:[~2004-03-25  9:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-08 11:37 [patch] 21.3 executable.find - Use cache in `executable-find' Jari Aalto+mail.linux
2004-03-24 11:13 ` Eli Zaretskii
     [not found]   ` <y8pp51f9.fsf@blue.sea.net>
2004-03-25  6:49     ` Eli Zaretskii
2004-03-25  9:14       ` Jari Aalto+mail.linux [this message]
     [not found] <mailman.2083.1076239601.928.bug-gnu-emacs@gnu.org>
2004-02-10 21:21 ` Jari Aalto+mail.linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=k71947c4.fsf@blue.sea.net \
    --to=jari.aalto@poboxes.com \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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