From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Sebastian Sturm Newsgroups: gmane.emacs.devel Subject: Re: State of the overlay tree branch? Date: Mon, 19 Mar 2018 00:20:13 +0100 Message-ID: <86d03e78-9984-f33e-a3f3-3faa4b34d78b@arkona-technologies.de> References: <834lldp18f.fsf@gnu.org> <9646341d-700b-4240-216b-8c0e753fa79f@arkona-technologies.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1521415105 3073 195.159.176.226 (18 Mar 2018 23:18:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 18 Mar 2018 23:18:25 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 19 00:18:21 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 1exhZE-0000hc-RA for ged-emacs-devel@m.gmane.org; Mon, 19 Mar 2018 00:18:20 +0100 Original-Received: from localhost ([::1]:39446 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1exhbH-00076z-QD for ged-emacs-devel@m.gmane.org; Sun, 18 Mar 2018 19:20:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45137) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1exhbB-00076c-8c for emacs-devel@gnu.org; Sun, 18 Mar 2018 19:20:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1exhb6-0002E7-9K for emacs-devel@gnu.org; Sun, 18 Mar 2018 19:20:21 -0400 Original-Received: from smtp-out002.kontent.com ([81.88.40.216]:57806) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1exhb5-0002Dh-VQ for emacs-devel@gnu.org; Sun, 18 Mar 2018 19:20:16 -0400 Original-Received: from [192.168.0.102] (unknown [82.195.74.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: arkona-technologies_de_22@smtp-out002.kontent.com) by smtp-out002.kontent.com (Postfix) with ESMTPSA id 1B1C2C01287A1 for ; Mon, 19 Mar 2018 00:20:14 +0100 (CET) In-Reply-To: <9646341d-700b-4240-216b-8c0e753fa79f@arkona-technologies.de> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 81.88.40.216 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:223796 Archived-At: for the record, I just switched back to emacs master (no noverlay) and=20 the time reported by (benchmark-run 1000 (line-number-at-pos (point))=20 increased by a factor of ~40, to 75-80s. At this level, editing is=20 unbearably slow. With the semantic highlighter disabled, the same=20 measurement yields ~2.5s (still painfully slow, but borderline usable),=20 so about the same time reported by the noverlay branch. To me, this suggests that noverlay indeed improves performance, though=20 not necessarily to the level I had previously claimed. find_newline may=20 solve this particular issue completely. Since the time taken by line-number-at-pos seems to fluctuate wildly for=20 (to me) unknown reasons, I'll try and see if I can set up a systematic=20 way to collect reliable data. On 03/19/2018 12:03 AM, Sebastian Sturm wrote: > concerning the performance improvement with noverlay, it seems I spoke=20 > to soon. I've now had the issue reappear, both with the noverlay branch= ,=20 > and with the semantic highlighter set to use font-lock. Sorry for the=20 > misinformation. > Again, however, line-number-at-pos shows up as a large CPU time consume= r=20 > in the profiler report, and benchmark-run still reports several ms per=20 > invocation (though this time it's usually around 2 to 4 ms instead of=20 > the 20 to 25 I measured earlier), so I'd still be very much interested=20 > in a faster line-number-at-pos implementation. >=20 > On 03/18/2018 10:04 PM, Sebastian Sturm wrote: >> I also found it surprising that overlays would slow down line=20 >> counting, but since I don't know anything about the architecture of=20 >> the Emacs display engine, or its overlay implementation, I figured=20 >> that overlays must be to blame because >> >> (i) the issue went away after switching to the feature/noverlay branch >> >> (ii) configuring the semantic highlighter to use its font-lock backend= =20 >> also resolved the performance issue (though with the font-lock=20 >> backend, highlights are easily messed up by editing operations which=20 >> makes the overlay variant far more appealing) >> >> I also found that some other heavy users of overlays such as=20 >> avy-goto-word-0-{above,below} feel faster with the feature/noverlay=20 >> branch, so I'd welcome a merge of the overlay branch even if there was= =20 >> a technically superior alternative to line-number-at-pos that didn't=20 >> suffer from overlay-related performance issues. >> >> That being said, your suggestion sounds intriguing. What would be=20 >> required to expose find_newline to Lisp? Would I simply have to wrap=20 >> it in one of Emacs's DEFINE_ macros? Is there some=20 >> documentation on the Emacs C backend? >> >> On 03/18/2018 09:39 PM, Eli Zaretskii wrote: >> =C2=A0>> From: Sebastian Sturm >> =C2=A0>> Date: Sun, 18 Mar 2018 21:14:53 +0100 >> =C2=A0>> >> =C2=A0>> [1] I'm using cquery for my C++ editing needs, which comes wi= th an >> =C2=A0>> overlay-based semantic highlighting mechanism. With my emacs >> =C2=A0>> configuration, lsp-mode/lsp-ui emit 6 calls to line-number-at= -pos per >> =C2=A0>> character insertion, which consume ~20 to 25 ms each when per= forming >> =C2=A0>> edits close to the bottom of a 66KB C++ file (measured using >> =C2=A0>> (benchmark-run 1000 (line-number-at-pos (point))) on a releas= e=20 >> build of >> =C2=A0>> emacs-27/git commit #9942734...). Using the noverlay branch, = this=20 >> figure >> =C2=A0>> drops to ~160us per call. >> =C2=A0> >> =C2=A0> If lsp-mode/lsp-ui needs a fast line counter, one can easily b= e >> =C2=A0> provided by exposing find_newline to Lisp.=C2=A0 IME, it's lig= htning-fast, >> =C2=A0> and should run circles around count-lines (used by=20 >> line-number-at-pos). >> =C2=A0> >> =C2=A0> (I'm not sure I even understand how overlays come into play he= re, >> =C2=A0> btw.) >> >=20