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

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

Re: point-at-final-line


From: Emanuel Berg
Subject: Re: point-at-final-line
Date: Sat, 27 Jan 2018 04:02:33 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Seems to be virtually no difference
in performance.

So I'll go with the best-looking code, which is
"point-at-final-line".

Unless there are new facts to the case brought
to the courts attention...

(defmacro measure-time (&rest body)
  "Measure and return the running time of the code block.
Not mine: http://nullprogram.com/blog/2009/05/28/";
  (declare (indent defun))
  (let ((start (make-symbol "start")))
    `(let ((,start (float-time)))
       ,@body
       (- (float-time) ,start))))

(defun point-at-final-line ()
  (= (line-number-at-pos)
     (line-number-at-pos (point-max)) ))
;; (insert (format "\n;; %f" (measure-time #'point-at-final-line)))
;; 0.000005

(defun point-at-final-line-2 ()
  (save-excursion
    (end-of-line)
    (= 1 (forward-line 1)) ))
;; (insert (format "\n;; %f" (measure-time #'point-at-final-line-2)))
;; 0.000006

-- 
underground experts united
http://user.it.uu.se/~embe8573


reply via email to

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