From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen 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 18:45:51 +0100 Message-ID: <87h7mn22ls.fsf@gnus.org> References: <83y4aclofm.fsf@gnu.org> <878s7z532u.fsf@gnus.org> <87y2fz3lpe.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25878"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 22763@debbugs.gnu.org, Keith David Bershatsky To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 07 18:48:07 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 1l8oAJ-0006cp-4U for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Feb 2021 18:48:07 +0100 Original-Received: from localhost ([::1]:45186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l8oAI-0003ur-7q for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Feb 2021 12:48:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l8o9G-0003Et-3k for bug-gnu-emacs@gnu.org; Sun, 07 Feb 2021 12:47:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37122) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l8o9F-0004VK-SU for bug-gnu-emacs@gnu.org; Sun, 07 Feb 2021 12:47:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l8o9F-00074l-QR for bug-gnu-emacs@gnu.org; Sun, 07 Feb 2021 12:47:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Feb 2021 17:47:01 +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.161271997427144 (code B ref 22763); Sun, 07 Feb 2021 17:47:01 +0000 Original-Received: (at 22763) by debbugs.gnu.org; 7 Feb 2021 17:46:14 +0000 Original-Received: from localhost ([127.0.0.1]:48668 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l8o8T-00073j-7u for submit@debbugs.gnu.org; Sun, 07 Feb 2021 12:46:14 -0500 Original-Received: from quimby.gnus.org ([95.216.78.240]:38212) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l8o8O-00073K-Vh for 22763@debbugs.gnu.org; Sun, 07 Feb 2021 12:46:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=IjGwLEdCpcdFDMJeDk92L9Ajd+M3LvkOvDKHAAl1QS4=; b=Rppqsu/ey44ruLqXoMZ6cgvnqw hOee0jziIw5FgsC/pOqHQTqV8Bkt4aWKFfRkitnO/8tYnv1gDuF3m13HEcXdI26YsLSZwmZCReIU6 mF6IZopxaq4/sv6Ka2R9npGPM7YbOV38nthunXAC3gRLy6q8VVayuTCdFShfDi6QA+S4=; Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l8o88-00034f-Ny; Sun, 07 Feb 2021 18:46:01 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAD1BMVEUkGRdVIxxoSSek Rh7////0Jn+1AAAAAWJLR0QEj2jZUQAAAAd0SU1FB+UCBQsDEP2ML4UAAAGqSURBVDjLjVOBjcMw CIR0AcALGLJAHe+/2x+4SfrSV1+kuNRnDBxnoo+myuQqrKZ9I+YOv4DwDd9gD3hdNcK89wphEsIp FqHOLJp/6X9j25zc/0AKiC+uQPLN3DMpknMW/yqXgs0DXUQ3lLoxFjurqjOKKoVRdvBXmb6wu2t+ 31TVG7jc2nwDhq4wfPx8p2kMLGITDe7z2pV1A7c5n/SYU+5rsee2zzmH7HOorPSoYp52wEW+E5iD saGxzwDYsuKkCIDKpmLhHHOYPi8AkUZmmzUAxEcCWgR4RhvpfmRJjUZOhmo67MLCyIykDx2OoeUU uPoQ9JA9boFAX904JxzT90yCwEd0quugSyYLHXMWYLMvzpMXMlSgOwuASNqqSxSOss2tiBjtZAzU OkQNS2A/Lo41HwEmxJxhDZ2eI8QQOSnIpeGhxAncJtoe2o9TAzeQsWt0UgAYyVFK/VyKwDnsjCI6 D4K7FyApdtyi9c6yFl2Cg5f0AuN6jJe4as45OD1VqUtoda/Kegt1mhdX8hrxLWldrpSA26VzJv2l +tt9U/aHh8IlDCq1/GM/Y+AwNiS2qcAAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjEtMDItMDVUMTE6 MDM6MTUrMDA6MDAgZXUcAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIxLTAyLTA1VDExOjAzOjE1KzAw OjAwUTjNoAAAAABJRU5ErkJggg== X-Now-Playing: Mia Doi Todd & Company's _Music for A Midsummer Night's Dream_: "Earthly Happiness" In-Reply-To: (Stefan Monnier's message of "Sun, 07 Feb 2021 12:40:43 -0500") 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:199523 Archived-At: Stefan Monnier writes: > Why is it faster? > > Is it still always =CE=98(N) just with a smaller constant (if so, what ma= kes > the constant smaller), or does it benefit from some kind of caching > (which I fail to see in the code) such that it's O(N) sometimes but much > faster other times (and if so, what are the cases that are sped up)? There's no caching. I guess find_newline is just slow compared to display_count_lines? (How many of these functions do we have in the C layer, anyway?) --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no