[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: timing Emacs 21 (was: comments on ntemacs 21.0.91)
From: |
Robert J. Chassell |
Subject: |
Re: timing Emacs 21 (was: comments on ntemacs 21.0.91) |
Date: |
Fri, 1 Dec 2000 11:17:16 -0500 (EST) |
Sometimes Emacs 20.7 is faster than the current Emacs 21
and sometimes it is slower.
forward-char Emacs 21 faster
forward-line Emacs 21 faster
forward-word Emacs 20 faster
forward-sentence Emacs 20 considerably faster
forward-paragraph Emacs 20 considerably faster
I used todays' GNU Emacs 21 CVS snapshot of Fri, 2000 Dec 1 13:20 GMT
started as:
/usr/local/bin/emacs -q --no-site-file -eval '(blink-cursor-mode 0)'
and a vanilla Emacs 20.7
started as:
/usr/bin/emacs -q --no-site-file
both i386-debian-linux-gnu, X toolkit
on /usr/local/src/emacs/lisp/loaddefs.el
Here are the details:
(time-action 500000 (quote forward-char))
Emacs 20.7: total time 2.05455 seconds
Emacs 21: total time 1.95983 seconds
(/ 2.05455 1.95983) --> 1.0483307225626712 Emacs 21 faster
(time-action 100000 (quote forward-word-1))
Emacs 20.7: total time 0.667677 seconds
Emacs 21: total time 0.789962 seconds
(/ 0.667677 0.789962) --> 0.8452014147515955 Emacs 20 faster
(time-action 10000 (quote forward-line))
Emacs 20.7: total time 0.050145 seconds
Emacs 21: total time 0.047895 seconds
(/ 0.050145 0.047895) -->1.0469777638584403 Emacs 21 faster
(time-action 10000 (quote forward-sentence))
Emacs 20.7: total time 2.2367 seconds
Emacs 21: total time 6.07811 seconds
(/ 2.2367 6.07811) --> 0.36799268193566753 Emacs 20 faster
(time-action 3000 (quote forward-paragraph))
Emacs 20.7: total time 0.525678 seconds
Emacs 21: total time 1.32064 seconds
(/ 0.525678 1.32064) --> 0.3980479161618609 Emacs 20 faster
Here is the progn I used to generate these figures,
and a copy of Andrew Innes' time-action code, slightly modified.
;; Time an action
;;
;; /usr/local/src/emacs/lisp/loaddefs.el
;;
;; 768,000 bytes
;; 120,000 words
;; 17,800 lines
;;
;;
;; (progn
;; (find-file "/usr/local/src/emacs/lisp/loaddefs.el")
;; (load-file "/home/bob/emacs/time-action.el")
;; (goto-char (point-min))
;; (print "(time-action 500000 (quote forward-char))")
;; (time-action 500000 (quote forward-char))
;; (goto-char (point-min))
;; (print "(time-action 100000 (quote forward-word-1))")
;; (time-action 100000 (quote forward-word-1))
;; (goto-char (point-min))
;; (print "(time-action 10000 (quote forward-line))")
;; (time-action 10000 (quote forward-line))
;; (goto-char (point-min))
;; (print "(time-action 10000 (quote forward-sentence))")
;; (time-action 10000 (quote forward-sentence))
;; (goto-char (point-min))
;; (print "(time-action 3000 (quote forward-paragraph))")
;; (time-action 3000 (quote forward-paragraph))
;; (goto-char (point-min))
;; (switch-to-buffer "*Messages*")
;; )
;;
;;
;; For a vanilla Emacs 20:
;;
;; /usr/bin/emacs -q --no-site-file
;;
;; For a vanilla Emacs 21:
;;
;; /usr/local/bin/emacs -q --no-site-file -eval '(blink-cursor-mode 0)'
;; The following defun is used for timing forward-word
(defun forward-word-1 ()
"Go forward one word."
(forward-word 1))
;; Written by Andrew Innes <address@hidden>, 1998-2000.
;; Released into public domain.
(defun elapsed-time (start finish)
(-
(+ (* 65536.0 (nth 0 finish))
(nth 1 finish)
(* 1e-6 (nth 2 finish)))
(+ (* 65536.0 (nth 0 start))
(nth 1 start)
(* 1e-6 (nth 2 start)))))
;;;; corrected for bug with millisecond times
;; (defun time-action (iterations action)
;; (interactive "nRepeat count: \naaction function: ")
;; (let ((i 0)
;; (start (current-time))
;; control
;; finish
;; (next-line-add-newlines t))
;; (while (< i iterations)
;; (funcall (lambda ()))
;; (setq i (1+ i)))
;; (setq control (current-time))
;; (setq i 0)
;; (while (< i iterations)
;; ;;(next-line 1)
;; ;;(forward-char 1)
;; ;;(scroll-up)
;; ;;(redraw-display)
;; ;; attempt to force redisplay
;; ;;(sit-for 0)
;; (funcall action)
;; (setq i (1+ i)))
;; (setq finish (current-time))
;; (message "total time %g seconds; average time taken was %g ms"
;; (elapsed-time control finish)
;; (/ (* 1000.0 (- (elapsed-time control finish)
;; (elapsed-time start control))) iterations))))
(defun time-action (iterations action)
(interactive "nRepeat count: \naaction function: ")
(let ((i 0)
(start (current-time))
(finish (current-time))
(next-line-add-newlines t))
(while (< i iterations)
(funcall action)
(setq i (1+ i)))
(setq finish (current-time))
(message
"total time %g seconds"
(-
(string-to-int
(concat
(int-to-string (elt finish 1)) "." (int-to-string (elt finish 2))))
(string-to-int
(concat
(int-to-string (elt start 1)) "." (int-to-string (elt start 2))))))))
(defun sit-for-keyboard-input (seconds &optional nodisp)
"As sit-for, except only recognizes keyboard input."
(let ((start (current-time))
input
finish
done)
(while (and (not done) (not (sit-for seconds nil nodisp)))
(setq input (read-event))
;;(message "(read %S)" input)
(if (not (memq (event-basic-type input)
'(mouse-1 mouse-2 mouse-3
iconify-frame switch-frame
delete-frame make-frame-visible)))
;; keyboard input of some type
(progn
(setq done t)
(setq unread-command-events
(append unread-command-events (list input))))
;; some other kind of event - discard and resume wait
(setq finish (current-time))
(setq seconds (- seconds (elapsed-time start finish)))))))
;;; provide functions for automated testing
(defun scroll-and-display ()
(next-line 1)
(sit-for 0))
(defun view-test-file ()
(find-file "C:/andrewi/emacs-20.4/lisp/loaddefs.el")
(message ""))
(require 'font-lock)
(defun test-fontify ()
(interactive)
(let ((global-font-lock-mode t)
(font-lock-support-mode nil)
(font-lock-maximum-size nil))
(view-test-file)
(font-lock-mode -1)
(setq font-lock-maximum-size nil)
(time-action 1 'font-lock-mode)))
(defun test-scroll-font-lock ()
(interactive)
(let ((global-font-lock-mode t)
(font-lock-support-mode nil)
(font-lock-maximum-size nil)
(line-number-mode t)
(column-number-mode t))
(view-test-file)
(setq font-lock-maximum-size nil)
(font-lock-mode 1)
(time-action 3000 'scroll-and-display)))
(defun test-scroll-no-font-lock ()
(interactive)
(let ((font-lock-global-modes nil))
(view-test-file)
(fundamental-mode)
(time-action 3000 'scroll-and-display)))
(defun test-scroll-font-lock-simple ()
(interactive)
(let ((global-font-lock-mode t)
(font-lock-support-mode nil)
(font-lock-maximum-size nil)
(line-number-mode nil)
(column-number-mode nil))
(view-test-file)
(setq font-lock-maximum-size nil)
(font-lock-mode 1)
(time-action 3000 'scroll-and-display)))
(defun test-scroll-no-font-lock-simple ()
(interactive)
(let ((font-lock-global-modes nil)
(line-number-mode nil)
(column-number-mode nil))
(view-test-file)
(fundamental-mode)
(time-action 3000 'scroll-and-display)))
(defun test-scroll-no-font-lock-simple2 ()
(interactive)
(let ((font-lock-global-modes nil)
(line-number-mode nil)
(column-number-mode t))
(view-test-file)
(fundamental-mode)
(setq goal-column 35)
(time-action 3000 'scroll-and-display)))
(defun test-scroll-split-horiz ()
(interactive)
(let ((font-lock-global-modes nil)
(line-number-mode nil)
(column-number-mode nil))
(view-test-file)
(fundamental-mode)
(split-window-horizontally)
(time-action 300 'scroll-and-display)))
(defun test-scroll-split-vert ()
(interactive)
(let ((font-lock-global-modes nil)
(line-number-mode nil)
(column-number-mode nil))
(view-test-file)
(fundamental-mode)
(split-window-vertically)
(time-action 300 'scroll-and-display)))
(defvar test-stat-cache-dir "D:/andrewi/emacs-19.34/lisp")
(defun test-stat-caching ()
(interactive)
(let ((win32-enable-stat-cache -1))
(mapcar
'file-attributes
(directory-files test-stat-cache-dir nil nil t))))
(defun test-no-stat-caching ()
(interactive)
(let ((win32-enable-stat-cache nil))
(mapcar
'file-attributes
(directory-files test-stat-cache-dir nil nil t))))
(defvar test-byte-compile-file "D:/tmp/cc-mode.el")
(defun test-byte-compile-verbose ()
(interactive)
(let ((byte-compile-verbose t)
(byte-compile-warnings nil))
(time-action 1 (lambda () (byte-compile-file test-byte-compile-file)))))
(defun test-byte-compile-quiet ()
(interactive)
(let ((byte-compile-verbose nil)
(byte-compile-warnings nil))
(time-action 1 (lambda () (byte-compile-file test-byte-compile-file)))))
;;; end time action code
- Re: comments on ntemacs 21.0.91, Eli Zaretskii, 2000/12/01
- Re: comments on ntemacs 21.0.91, Andrew Innes, 2000/12/01
- Re: timing Emacs 21 (was: comments on ntemacs 21.0.91),
Robert J. Chassell <=
- Re: timing Emacs 21 (was: comments on ntemacs 21.0.91), Eli Zaretskii, 2000/12/01
- Re: timing Emacs 21 (was: comments on ntemacs 21.0.91), Gerd Moellmann, 2000/12/02
- Re: timing Emacs 21 (was: comments on ntemacs 21.0.91), Eli Zaretskii, 2000/12/02
- Re: timing Emacs 21 (was: comments on ntemacs 21.0.91), Robert J. Chassell, 2000/12/02
- Re: timing Emacs 21 (was: comments on ntemacs 21.0.91), Robert J. Chassell, 2000/12/04
Re: comments on ntemacs 21.0.91, Eli Zaretskii, 2000/12/01
Re: comments on ntemacs 21.0.91, Gerd Moellmann, 2000/12/02