[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: |
Mon, 4 Dec 2000 10:18:55 -0500 (EST) |
Here are timing results from code that evokes (sit-for 0).
Currently, Emacs 20 is much faster than Emacs 21.
The machine used is a Pentium I, 100 MHz, 58 Mb RAM
GNU Emacs 20.7.2 (i386-debian-linux-gnu, X toolkit)
GNU Emacs 21.0.93.1 (i686-debian-linux-gnu, X toolkit),
CVS snapshot of Sat, 2000-12-02
Here are the results, followed by the code used:
Each line reflects the results from the following, in this order:
Emacs 20
Emacs 21: value of redisplay-dont-pause is nil
Emacs 21: value of redisplay-dont-pause is t
repeat 10000 times: forward-char
total time 25.5338 seconds
total time 39.6157 seconds
total time 40.1087 seconds
repeat 10000 times: forward-word-1
total time 30.6415 seconds
total time 45.0425 seconds
total time 50.6444 seconds
repeat 1000 times: forward-line
total time 5.27222 seconds
total time 13.2925 seconds
total time 14.3871 seconds
repeat 1000 times: forward-sentence
total time 16.8116 seconds
total time 25.2589 seconds
total time 25.3916 seconds
repeat 300 times: forward-paragraph
total time 3.62143 seconds
total time 9.02803 seconds
total time 8.598 seconds
Here is the code used; the `progn' was copied to *scratch* and evaluated.
;;; Time an action /home/bob/emacs/time-action.el
;; (progn
;; (find-file "/usr/local/src/emacs/lisp/loaddefs.el")
;; (load-file "/home/bob/emacs/time-action.el")
;;
;; ;; *Non-nil means update isn't paused when input is detected.
;; ;; Default value is nil, so update is paused
;; (princ "value of redisplay-dont-pause is t\n" )
;; (setq redisplay-dont-pause t)
;; (terpri)
;;
;; (princ "repeat 10000 times: forward-char")
;; (goto-char (point-min))
;; (time-action 10000 (quote forward-char))
;; (terpri)
;;
;; (princ "repeat 10000 times: forward-word-1")
;; (goto-char (point-min))
;; (time-action 10000 (quote forward-word-1))
;; (terpri)
;;
;; (princ "repeat 1000 times: forward-line")
;; (goto-char (point-min))
;; (time-action 1000 (quote forward-line))
;; (terpri)
;;
;; (princ "repeat 1000 times: forward-sentence")
;; (goto-char (point-min))
;; (time-action 1000 (quote forward-sentence))
;; (terpri)
;;
;; (princ "repeat 300 times: forward-paragraph")
;; (goto-char (point-min))
;; (time-action 300 (quote forward-paragraph))
;; (terpri)
;;
;; (goto-char (point-min))
;; (switch-to-buffer "*Messages*")
;; )
;;; start time action code
;; 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)
;; attempt to force redisplay
(sit-for 0)
(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 /home/bob/emacs/time-action.el
Re: comments on ntemacs 21.0.91, Eli Zaretskii, 2000/12/01
Re: comments on ntemacs 21.0.91, Gerd Moellmann, 2000/12/02