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: Sun, 18 Mar 2018 22:04:13 +0100 Message-ID: References: <834lldp18f.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1521406950 20676 195.159.176.226 (18 Mar 2018 21:02:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 18 Mar 2018 21:02:30 +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 Sun Mar 18 22:02:26 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 1exfRh-0005HU-W2 for ged-emacs-devel@m.gmane.org; Sun, 18 Mar 2018 22:02:26 +0100 Original-Received: from localhost ([::1]:39149 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1exfTl-0005Pb-1t for ged-emacs-devel@m.gmane.org; Sun, 18 Mar 2018 17:04:33 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54646) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1exfTX-0005PM-Iv for emacs-devel@gnu.org; Sun, 18 Mar 2018 17:04:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1exfTU-0004zX-FI for emacs-devel@gnu.org; Sun, 18 Mar 2018 17:04:19 -0400 Original-Received: from smtp-out002.kontent.com ([81.88.40.216]:46787) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1exfTU-0004z7-8E for emacs-devel@gnu.org; Sun, 18 Mar 2018 17:04: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 A9EE5C01287AF for ; Sun, 18 Mar 2018 22:04:13 +0100 (CET) In-Reply-To: <834lldp18f.fsf@gnu.org> 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:223793 Archived-At: I also found it surprising that overlays would slow down line counting, but since I don't know anything about the architecture of the Emacs display engine, or its overlay implementation, I figured 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 also resolved the performance issue (though with the font-lock backend, highlights are easily messed up by editing operations which makes the overlay variant far more appealing) I also found that some other heavy users of overlays such as avy-goto-word-0-{above,below} feel faster with the feature/noverlay branch, so I'd welcome a merge of the overlay branch even if there was a technically superior alternative to line-number-at-pos that didn't suffer from overlay-related performance issues. That being said, your suggestion sounds intriguing. What would be required to expose find_newline to Lisp? Would I simply have to wrap it in one of Emacs's DEFINE_ macros? Is there some documentation on the Emacs C backend? On 03/18/2018 09:39 PM, Eli Zaretskii wrote: >> From: Sebastian Sturm >> Date: Sun, 18 Mar 2018 21:14:53 +0100 >> >> [1] I'm using cquery for my C++ editing needs, which comes with an >> overlay-based semantic highlighting mechanism. With my emacs >> configuration, lsp-mode/lsp-ui emit 6 calls to line-number-at-pos per >> character insertion, which consume ~20 to 25 ms each when performing >> edits close to the bottom of a 66KB C++ file (measured using >> (benchmark-run 1000 (line-number-at-pos (point))) on a release build of >> emacs-27/git commit #9942734...). Using the noverlay branch, this figure >> drops to ~160us per call. > > If lsp-mode/lsp-ui needs a fast line counter, one can easily be > provided by exposing find_newline to Lisp. IME, it's lightning-fast, > and should run circles around count-lines (used by line-number-at-pos). > > (I'm not sure I even understand how overlays come into play here, > btw.)