From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Aaron Jensen Newsgroups: gmane.emacs.bugs Subject: bug#24048: 25.0.95; syntax-ppss can be slow Date: Fri, 30 Mar 2018 06:09:45 -0700 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1522415298 24169 195.159.176.226 (30 Mar 2018 13:08:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 30 Mar 2018 13:08:18 +0000 (UTC) To: Dmitry Gutov , 24048@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 30 15:08:13 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1f1tlL-00069Y-8H for geb-bug-gnu-emacs@m.gmane.org; Fri, 30 Mar 2018 15:08:11 +0200 Original-Received: from localhost ([::1]:35735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1tnO-00058K-SC for geb-bug-gnu-emacs@m.gmane.org; Fri, 30 Mar 2018 09:10:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34005) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1tnD-00054y-Ay for bug-gnu-emacs@gnu.org; Fri, 30 Mar 2018 09:10:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f1tn8-0002eV-CK for bug-gnu-emacs@gnu.org; Fri, 30 Mar 2018 09:10:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51653) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f1tn8-0002eB-6Z for bug-gnu-emacs@gnu.org; Fri, 30 Mar 2018 09:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1f1tn8-00052M-0w for bug-gnu-emacs@gnu.org; Fri, 30 Mar 2018 09:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Aaron Jensen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 30 Mar 2018 13:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24048 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24048-submit@debbugs.gnu.org id=B24048.152241539319343 (code B ref 24048); Fri, 30 Mar 2018 13:10:01 +0000 Original-Received: (at 24048) by debbugs.gnu.org; 30 Mar 2018 13:09:53 +0000 Original-Received: from localhost ([127.0.0.1]:59550 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f1tmz-00051v-64 for submit@debbugs.gnu.org; Fri, 30 Mar 2018 09:09:53 -0400 Original-Received: from mail-qk0-f181.google.com ([209.85.220.181]:45328) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f1tmx-00051i-Hx for 24048@debbugs.gnu.org; Fri, 30 Mar 2018 09:09:51 -0400 Original-Received: by mail-qk0-f181.google.com with SMTP id s9so9025785qke.12 for <24048@debbugs.gnu.org>; Fri, 30 Mar 2018 06:09:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=3AIXvkpNrG5S8Kf7pWxAkrrgnmARnB1A66eYwOha3Tk=; b=mYArbIUq4U23IQ9MOezeGRBMvmpDEz/twqZAWDP31Ww+cXvlnbvNc6qVORko92zJZn FBXIc8Q1d0AkXnPAocSZRE1zlu7ZvbY5+dLsmqtqyJeA9VuidVahvihcO9pBa8xwArGP MSmh4ott0T4cUjcsgBTb0BNbYyIxk7z4qrkR4oEgk0kiqJl8grxSm+XKCvyvj9sv3Emb j4UcRMiBkh6MrlEs4MKOHMnY9L5dhD2XFFztk8Lyx5tGS7ReWsicyJpwJwpLHZ37pqwn zidXQwlnLe+jKOXeWkFZk1k10bGaEH1vhqNGqaune1lZbEGnd+9FhQjYTm/SW74Ag96w h3Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=3AIXvkpNrG5S8Kf7pWxAkrrgnmARnB1A66eYwOha3Tk=; b=cSZimCO0juIO4Vp6Gg8vcEQF+lteIto0eIfqjpSt79qUY/7v2IRJ8qKuEVMmz3JzEL 5lxoWsh4j5tgmVypFF3xEsfDmqrWV4INCMzej/5P2Ubb7CSQmerBB3jxTkctt26Dn09h WDFqvXJwaprr+WFPmIB5idTQwOLHyNkXjpz5KfEDs0Ayf2G9igMwf2aNzHIspt1XCLVz /UOi38PqsAG1gxdcdPTsKQj4pNkdeTv4q4nhayCssNLmSpjnjFJosgz3QsNfz8bosKZL yVZyiAEuOckqP7nsUNDtNhmhftrKUllYhIwx6CdDf0uESY/rpiqhvUjBtRJE1b6HYf+j xOxA== X-Gm-Message-State: AElRT7HO/WPwAwKAgXaV3d+zm23GAeXyKL+fGh8kSmuccb0PFzfw9BGg mJ7o0pKawtmTQOys5qkonbDY/UV3M3H0F1qSI/E= X-Google-Smtp-Source: AIpwx48iUppxfMr9bXJaRmOfxAvbB0Cmb04RJot7VB0aBXd5jh/mvA417md6LCl619nWkRwvFNEOQn8gcVC8SscEaJw= X-Received: by 10.233.221.2 with SMTP id r2mr16581550qkf.259.1522415386197; Fri, 30 Mar 2018 06:09:46 -0700 (PDT) Original-Received: by 10.237.60.76 with HTTP; Fri, 30 Mar 2018 06:09:45 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:144740 Archived-At: On Mon, Jul 25, 2016 at 8:08 AM, Aaron Jensen wrote= : > On Mon, Jul 25, 2016 at 5:42 AM Dmitry Gutov wrote: >> >> Is 5.6ms really significant? You should be typing like 200 characters >> per _second_ to really notice the difference. >> >> Even 12ms that I'm getting at the bottom of your example file doesn't >> sound like it should have effect on the perceptible latency. > > Even if one can=E2=80=99t feel 5.6ms, it becomes another brick in the bag= , i.e. if another minor mode did something similar and added another 5.6ms.= With enough of them most people could probably feel it. Hey all, I'm trying to clean up bugs I've submitted. This one is still an issue of sorts. I've fixed the downstream usage of syntax-ppss by memoizing it, but that feels like it should be unnecessary given that syntax-ppss is meant to do its own caching. The problem here is that syntax-ppss will not update its cache if it is "close enough" to the old position. In languages like Elixir (and probably Ruby) the old position is often the beginning of the outer module which spans most, if not all of the file. This means that the further you get down the file, the further you get from the old position and the more work syntax-ppss must do. If a user of syntax-ppss is not careful (as was the case in smartparens) then syntax-ppss can be called multiple times in succession, which can add up to enough latency to be noticed. Ultimately, it seems like it may be worth reconsidering this condition: (and old-pos (< (- pos old-pos) ;; The time to use syntax-begin-function and ;; find PPSS is assumed to be about 2 * distance. (* 2 (/ (cdr (aref syntax-ppss-stats 5)) (1+ (car (aref syntax-ppss-stats 5))))))) But I do not know what other impacts that may have. Does anybody have any new thoughts on this? Thanks!