From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#22763: 25.1.50; Feature Request -- A faster method to obtain line number at position. Date: Sun, 07 Feb 2021 21:43:59 +0200 Message-ID: <8335y7mznk.fsf@gnu.org> References: <83y4aclofm.fsf@gnu.org> <878s7z532u.fsf@gnus.org> <87y2fz3lpe.fsf@gnus.org> <87h7mn22ls.fsf@gnus.org> <83eehrn408.fsf@gnu.org> <87y2fzzqxb.fsf@gnus.org> <87tuqnzqh2.fsf@gnus.org> <83blcvn1ku.fsf@gnu.org> <87czxbznly.fsf@gnus.org> <878s7zzn6n.fsf@gnus.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8233"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 22763@debbugs.gnu.org, esq@lawlist.com, monnier@iro.umontreal.ca To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 07 20:44:12 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l8pye-000232-8W for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Feb 2021 20:44:12 +0100 Original-Received: from localhost ([::1]:52968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l8pyd-0007FV-AQ for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Feb 2021 14:44:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41364) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l8pyV-0007E8-Fo for bug-gnu-emacs@gnu.org; Sun, 07 Feb 2021 14:44:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37318) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l8pyU-0006I4-8f for bug-gnu-emacs@gnu.org; Sun, 07 Feb 2021 14:44:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l8pyU-0001Yl-6w for bug-gnu-emacs@gnu.org; Sun, 07 Feb 2021 14:44:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Feb 2021 19:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22763 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed Original-Received: via spool by 22763-submit@debbugs.gnu.org id=B22763.16127270355976 (code B ref 22763); Sun, 07 Feb 2021 19:44:02 +0000 Original-Received: (at 22763) by debbugs.gnu.org; 7 Feb 2021 19:43:55 +0000 Original-Received: from localhost ([127.0.0.1]:48864 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l8pyN-0001YK-Bk for submit@debbugs.gnu.org; Sun, 07 Feb 2021 14:43:55 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:51704) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l8pyL-0001Y6-CI for 22763@debbugs.gnu.org; Sun, 07 Feb 2021 14:43:53 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:36445) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l8pyG-0006C6-1D; Sun, 07 Feb 2021 14:43:48 -0500 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4580 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1l8pyF-0006TS-1f; Sun, 07 Feb 2021 14:43:47 -0500 In-Reply-To: <878s7zzn6n.fsf@gnus.org> (message from Lars Ingebrigtsen on Sun, 07 Feb 2021 20:34:56 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:199552 Archived-At: > From: Lars Ingebrigtsen > Cc: 22763@debbugs.gnu.org, esq@lawlist.com, monnier@iro.umontreal.ca > Date: Sun, 07 Feb 2021 20:34:56 +0100 > > (with-temp-buffer > (dotimes (_ 10000) > (insert (make-string (random 4000) ?a) "\n")) > (benchmark-run 10 > (goto-char (point-min)) > (while (not (eobp)) > (line-number-at-pos (point)) > (forward-line 1)))) > > With this, the new version still wins... but only slightly. So the > cache does indeed help when we've got long lines (which was the point of > the cache, I guess?) Yes.