From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: JD Smith Newsgroups: gmane.emacs.devel Subject: Re: Temporarily select-window, without updating mode-line face and cursor fill? Date: Tue, 4 May 2021 15:28:57 -0400 Message-ID: References: <56F746A2-B842-421E-8FBF-EA5E93EA26CE@gmail.com> <83pmya8d49.fsf@gnu.org> <904A57C8-C268-412F-815F-782017F47D5D@gmail.com> <83eeep8w0m.fsf@gnu.org> <81F181EB-D3C1-4619-B42A-1F49321EC544@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.80.0.2.43\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_571092F8-5A8F-4386-A52C-E5EB21BE47DC" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38163"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue May 04 21:29:37 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1le0jg-0009kc-QO for ged-emacs-devel@m.gmane-mx.org; Tue, 04 May 2021 21:29:36 +0200 Original-Received: from localhost ([::1]:43696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1le0jf-0007Ek-Ok for ged-emacs-devel@m.gmane-mx.org; Tue, 04 May 2021 15:29:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49898) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1le0j8-0006px-TJ for emacs-devel@gnu.org; Tue, 04 May 2021 15:29:02 -0400 Original-Received: from mail-qk1-x735.google.com ([2607:f8b0:4864:20::735]:36621) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1le0j7-0006ov-4w; Tue, 04 May 2021 15:29:02 -0400 Original-Received: by mail-qk1-x735.google.com with SMTP id i17so9784653qki.3; Tue, 04 May 2021 12:29:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=8eqORtGzEb6avJa7y/aqH7oThaY2uvOJvVvCl/7+R3k=; b=onwtbFamHGWFlCnOhUeNJ8ec4NWHoWzrp4td9TJZDO/XLdgjsi2c/deteX0uGyjGkw MOMljw2manIU2jlZbxjhWhRpW1GiQeLcDRNRPSRDf8W3sC8X0CcfKf+Z2l5r3fc64QY3 SPXWSlFVVYqOcH8cO765IgIxyaYkR7ivBUtpi2WGdWf9Itvr1pB86UGv+RWKvyPsZvMQ kfLtBPZwe6fi6OOnzLNayViuKPNhUXToPBIM6xNxLBNOxgGu8PfLQA60WF/hDx9NZTOY 7kTGt0dGN4uw2KZsIfhTN4XIC/sG2FH+IojbHOLAmLAXscueNf+miMv0KGCr0AQppgla tmxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=8eqORtGzEb6avJa7y/aqH7oThaY2uvOJvVvCl/7+R3k=; b=pbpW6ZHHXL9Kd9O5Roj6pE/WB0Md3vUkpWieu8h498jhMvTF1AXm40/h8alFPEDtsG THWWzs/ji8+qZ6HZ01ETHzYkambZOp8D+k5JtqYEiABYEcW+ICh3LPSmhefxJsyON4Pv /mOYQxzHa9ywLCrSCVLkbSisL7gPLTxg/8/fR8MuE+oTao56lcgBuCvbTbjL0vXeVJ6D MffYw3Nw0HsE3ZZ5GFp/c1xhFhXESRbY2ClENbGBI0OEx6OjL5o7zjKgcMy+oy6b7dBu 7Km01pVJCeJLgyY0IKN0jOY/NS0dxjW6z7HqFhqRToAispw7EIlBn0lJcUO8HvMrKF/K WIgg== X-Gm-Message-State: AOAM531KeNZ5tlPNNvEHvfaRqjelkmG3o+A/fW05LQgjvkLuyPqoUauL uup63FpiNTmrDSN52MZtqMI= X-Google-Smtp-Source: ABdhPJxOA4S39Axc7VEEvXnf1UZPhMfrUmm/siy57+y5hlX5fNs/PbpNFeJ24LTnBQ+llgUKy5KcxQ== X-Received: by 2002:a05:620a:1427:: with SMTP id k7mr24971273qkj.91.1620156539335; Tue, 04 May 2021 12:28:59 -0700 (PDT) Original-Received: from smtpclient.apple ([131.183.130.191]) by smtp.gmail.com with ESMTPSA id g22sm452015qkl.73.2021.05.04.12.28.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 May 2021 12:28:58 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3654.80.0.2.43) Received-SPF: pass client-ip=2607:f8b0:4864:20::735; envelope-from=jdtsmith@gmail.com; helo=mail-qk1-x735.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:268888 Archived-At: --Apple-Mail=_571092F8-5A8F-4386-A52C-E5EB21BE47DC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On May 2, 2021, at 10:25 PM, Stefan Monnier = wrote: >=20 > (setq nlinum--line-number-cache nil)) Taking a closer look at Stefan=E2=80=99s idea here, and considering the = concerns people have about the set-window-point/format-mode-line = approach, I have implemented a new caching system based on nlinum, with = the regular old line-number-at-pos and count-lines underneath; see: = https://github.com/jdtsmith/mlscroll/blob/07a657d28d779c3bc56b0a2ea04cfc6d= 23c54897/mlscroll.el#L87 Neither format-mode-line nor window-point manipulation is needed now. = Unlike nlinum, it also does not require an after-change-function, opting = instead to save a buffer tick and point-min/max to look for buffer = modifications and any narrowing/widening. In practice it entirely = solves the long file scrolling bottleneck, since effectively all line = lookups during scrolling hit the cache, and cached computation of all 3 = line positions is >50x faster than even format-mode-line was. Thanks all for your suggestions/criticism/feedback. What I can conclude = is that the default approach line-number-at-pos takes of =E2=80=9Ccounting= all newlines from the start of the file=E2=80=9D is really painfully = inefficient.= --Apple-Mail=_571092F8-5A8F-4386-A52C-E5EB21BE47DC Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
On = May 2, 2021, at 10:25 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

(setq nlinum--line-number-cache nil))

Taking = a closer look at Stefan=E2=80=99s idea here, and considering the = concerns people have about the set-window-point/format-mode-line = approach, I have implemented a new caching system based on nlinum, with = the regular old line-number-at-pos and count-lines underneath; = see:


Neither format-mode-line nor = window-point manipulation is needed now.  Unlike nlinum, it also = does not require an after-change-function, opting instead to save a = buffer tick and point-min/max to look for buffer modifications and any = narrowing/widening.  In practice it entirely solves the long file = scrolling bottleneck, since effectively all line lookups during = scrolling hit the cache, and cached computation of all 3 line positions = is >50x faster than even format-mode-line was.
Thanks all for your = suggestions/criticism/feedback.  What I can conclude is that the = default approach line-number-at-pos takes of =E2=80=9Ccounting all = newlines from the start of the file=E2=80=9D is really painfully = inefficient.
= --Apple-Mail=_571092F8-5A8F-4386-A52C-E5EB21BE47DC--