all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* is there a emacs lisp timing command?
@ 2009-03-24  1:57 Xah Lee
  2009-03-24  6:12 ` thierry.volpiatto
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Xah Lee @ 2009-03-24  1:57 UTC (permalink / raw)
  To: help-gnu-emacs

is there a elisp command like timing, that returns the time a function
took?

while testing some performance issues, i tried to write one.

(defun xx-timing ()
  "returns the timing."
  (interactive)
  (let (starttime endtime)
    (setq starttime (current-time))

    ;; some function here
    (sleep-for 0 5)

    (setq endtime (current-time))
    (message "%f" (+ (* (- (elt endtime 0)
                           (elt starttime 0)) 65536)
                     (- (elt endtime 1)
                        (elt starttime 1))
                     (* (- (elt endtime 2)
                           (elt starttime 2)) 0.001)))
    ))

but after about 20 minutes on this, i gave up. It seems to me, when
microseconds is involved (returned by current-time), the result is
weired. I don't see any logical problem in my code, but the above code
is obvious wrong, often returning results some 70 seconds extra
whenever microseconds is involved.

anyone has written a timing command somewhere?

This is on:
GNU Emacs 22.2.1 (powerpc-apple-darwin8.11.0, Carbon Version 1.6.0) of
2008-04-05 on g5.tokyo.stp.isas.jaxa.jp

PowerPC G5, osx 10.4.11.

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-03-24 22:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-24  1:57 is there a emacs lisp timing command? Xah Lee
2009-03-24  6:12 ` thierry.volpiatto
2009-03-24  6:35   ` thierry.volpiatto
2009-03-24  6:46     ` thierry.volpiatto
2009-03-24  7:30 ` Helmut Eller
2009-03-24  8:11   ` thierry.volpiatto
2009-03-24 10:05 ` David Kastrup
2009-03-24 20:25 ` Nikolaj Schumacher
     [not found] ` <mailman.3921.1237926315.31690.help-gnu-emacs@gnu.org>
2009-03-24 22:07   ` Xah Lee

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.