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: Wed, 21 Mar 2018 17:35:05 +0200 Message-ID: <83sh8tjvbq.fsf@gnu.org> References: <834lldp18f.fsf@gnu.org> <87y3iltt1h.fsf@chapu.is> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1521646526 15934 195.159.176.226 (21 Mar 2018 15:35:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 21 Mar 2018 15:35:26 +0000 (UTC) Cc: s.sturm@arkona-technologies.de, emacs-devel@gnu.org To: Sebastien Chapuis Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 21 16:35: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 1eyflo-00042z-Se for ged-emacs-devel@m.gmane.org; Wed, 21 Mar 2018 16:35:20 +0100 Original-Received: from localhost ([::1]:55827 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyfnr-0004Qn-SU for ged-emacs-devel@m.gmane.org; Wed, 21 Mar 2018 11:37:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyflg-0002im-Mf for emacs-devel@gnu.org; Wed, 21 Mar 2018 11:35:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyfld-0001an-IT for emacs-devel@gnu.org; Wed, 21 Mar 2018 11:35:12 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52231) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyfld-0001aZ-EQ; Wed, 21 Mar 2018 11:35:09 -0400 Original-Received: from [176.228.60.248] (port=2998 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eyflc-0007nz-T9; Wed, 21 Mar 2018 11:35:09 -0400 In-reply-to: <87y3iltt1h.fsf@chapu.is> (message from Sebastien Chapuis on Wed, 21 Mar 2018 15:14:18 +0100) 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:223895 Archived-At: > From: Sebastien Chapuis > Cc: Sebastian Sturm , emacs-devel@gnu.org > Date: Wed, 21 Mar 2018 15:14:18 +0100 > > The language server protocol defines a position in file with zero-indexed > line and column offsets [1]: > > ``` > interface Position { > line: number; > character: number; > } > ``` > > lsp-mode uses heavily line-number-at-pos to convert an Emacs buffer > point to a LSP position, and vice-versa [2]. line-number-at-pos is inefficient, in that it always counts from the beginning of the buffer. By keeping already computed line numbers around, you could make a faster implementation if you count relative line offsets using count-lines instead. > This can happen thousands times on each keystroke. _Thousands_ times for _each_ keystroke? Why is that? Most keystrokes only change a single line, so how come you need thousands of lines recounted each time? > If Emacs could provide a function to do the conversion very fast (or at > least faster than with line-number-at-pos), it would be great. Given the above, I think you need to describe the issue in more details, before we even begin designing the solution.