From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: State of the overlay tree branch? Date: Mon, 19 Mar 2018 15:02:51 +0200 Message-ID: <83d100nrpg.fsf@gnu.org> References: > <834lldp18f.fsf@gnu.org>> <83tvtco8xl.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1521464456 7517 195.159.176.226 (19 Mar 2018 13:00:56 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 19 Mar 2018 13:00:56 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 19 14:00:52 2018 Return-path: Envelope-to: ged-emacs-devel@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 1exuPD-0001rY-NY for ged-emacs-devel@m.gmane.org; Mon, 19 Mar 2018 14:00:51 +0100 Original-Received: from localhost ([::1]:42000 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1exuRG-0007Wv-Vd for ged-emacs-devel@m.gmane.org; Mon, 19 Mar 2018 09:02:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1exuR5-0007WW-Ge for emacs-devel@gnu.org; Mon, 19 Mar 2018 09:02:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1exuR0-0001tU-Sp for emacs-devel@gnu.org; Mon, 19 Mar 2018 09:02:47 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:55378) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1exuR0-0001tK-P8; Mon, 19 Mar 2018 09:02:42 -0400 Original-Received: from [176.228.60.248] (port=2759 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1exuR0-0000jl-7z; Mon, 19 Mar 2018 09:02:42 -0400 In-reply-to: (message from Stefan Monnier on Mon, 19 Mar 2018 08:29:40 -0400) 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: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:223814 Archived-At: > From: Stefan Monnier > Cc: emacs-devel@gnu.org > Date: Mon, 19 Mar 2018 08:29:40 -0400 > > > But I don't believe [display_count_lines] could be orders of > > magnitude faster than count-lines, even though it doesn't need to > > convert character position to byte position. > > Scanning from the last used position can be *very* different from > scanning from point-min. So yes, it can be orders of magnitude faster Well, in my measurements it's already very fast. I don't understand why the OP sees times that are 10 times slower. > The > > for (tail = BUF_MARKERS (b); tail; tail = tail->next) > > loop in buf_charpos_to_bytepos and buf_bytepos_to_charpos. > > > But find_newline doesn't look for markers, and it converts character > > to byte position just 2 times. Or am I missing something? > > The idea is that the above loop (even if called only twice) might be > sufficient to make line-number-at-pos take 0.2s. I very much doubt that loop could take such a long time. And running a benchmark 1000 times means that the 2nd through 1000th iteration find the mapping much faster, probably bypassing the loop entirely. > So for them to cause the slow down seen here, we'd need not only > a very large number of markers but also additional conditions that might > not be very likely. > But it's still a possibility. I'll believe it when I see it.