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: Eli Zaretskii
Subject: Re: point-at-final-line
Date: Mon, 29 Jan 2018 18:04:48 +0200

> From: Emanuel Berg <moasen@zoho.com>
> Date: Mon, 29 Jan 2018 16:03:10 +0100
> 
> Eli Zaretskii wrote:
> 
> > Yes, counting lines is fast. But not counting
> > lines is even faster.
> >
> > You don't need to compute the number of the
> > current line, you just need to establish
> > whether the line current ends at EOB. Right?
> > And the line's end is given by
> > line-end-position, right?
> 
> If you mean like this
> 
> (defun point-at-final-line-3 ()
>   (= (line-end-position) (point-max)) )
> 
> I agree it looks the best thus far, however
> with 100 000 lines it is still 0.000005 just
> like the others.

Good engineering which leads to elegant solutions should be preferable
even when it has no tangible performance advantages.

(But I'm sure that if you run each function many times in a loop, you
will see some differences in timing.  Right now, I think the times are
below your system clock resolution, so you are measuring quantization
noise.)



reply via email to

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