From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: point-at-final-line Date: Mon, 29 Jan 2018 18:04:48 +0200 Message-ID: <83fu6oirbz.fsf@gnu.org> References: <868tckgl1y.fsf@zoho.com> <87vafom6af.fsf@bsb.me.uk> <86r2qcf1h2.fsf@zoho.com> <86wp01byil.fsf@zoho.com> <86d11sbtch.fsf@zoho.com> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1517241817 19133 195.159.176.226 (29 Jan 2018 16:03:37 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 29 Jan 2018 16:03:37 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 29 17:03:33 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1egBu6-0004XW-Gu for geh-help-gnu-emacs@m.gmane.org; Mon, 29 Jan 2018 17:03:30 +0100 Original-Received: from localhost ([::1]:47090 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1egBw7-0006mC-Cq for geh-help-gnu-emacs@m.gmane.org; Mon, 29 Jan 2018 11:05:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1egBvM-0006fo-El for help-gnu-emacs@gnu.org; Mon, 29 Jan 2018 11:04:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1egBvG-0004gy-8l for help-gnu-emacs@gnu.org; Mon, 29 Jan 2018 11:04:48 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60023) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1egBvG-0004gr-64 for help-gnu-emacs@gnu.org; Mon, 29 Jan 2018 11:04:42 -0500 Original-Received: from [176.228.60.248] (port=1763 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1egBvF-00075d-J5 for help-gnu-emacs@gnu.org; Mon, 29 Jan 2018 11:04:42 -0500 In-reply-to: <86d11sbtch.fsf@zoho.com> (message from Emanuel Berg on Mon, 29 Jan 2018 16:03:10 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:115875 Archived-At: > From: Emanuel Berg > 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.)