unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ship Mints <shipmints@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: Ergus <spacibba@aol.com>,
	Michael Albinus <michael.albinus@gmx.de>,
	73718@debbugs.gnu.org, Juri Linkov <juri@linkov.net>
Subject: bug#73718: 31.0.50; Severe performance issue with Tramp and project-mode-line-format
Date: Sun, 13 Oct 2024 09:31:12 -0400	[thread overview]
Message-ID: <CAN+1Hbp5c3yhPhKY6RDCEWjWAgUHeUhnKcK-KSNcaDpKkZnq5g@mail.gmail.com> (raw)
In-Reply-To: <CAN+1HboXQSf+LDwGADJVKiO1u_SeBPvhJhauzbbNXWuE2My-wQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2696 bytes --]

Forgot to add this counterpart for when you want to use a non-project
semaphore but also want to project-current to tell the truth about being a
non-project:

  (defun my/project-current-non-project-advice (orig-fun &rest args)
    (let ((p (apply orig-fun args)))
      (when (and p (string= (project-name p) my:project--non-project-dir))
        (setq p nil))
      p))
  (advice-add #'project-current :around
#'my/project-current-non-project-advice))

On Fri, Oct 11, 2024 at 10:35 AM Ship Mints <shipmints@gmail.com> wrote:

> In addition to guarding project-try-vc, I also have a customized cache for
> non-projects specifically to get around the incessant retesting for what
> are effectively invariant conditions.
>
> If of any utility to others:
>
> (use-package project
> ...
>   (defconst my:project--non-project-dir ".") ; nil disables the cache;
> NOTE: eglot relies on project-root so this has to be a real path
>   (defun my/project-try-non-project-cache (dir)
>     (unless (and my:project-vc-inhibit-remote (file-remote-p dir)) ; yet
> another optional remote guard
>       (let ((proj (cons 'transient (or my:project--non-project-dir
> (expand-file-name dir)))))
>         (vc-file-setprop dir 'project-vc proj) ; project caches via vc
> internal properties
>         proj)))
>   (add-to-list 'project-find-functions #'my/project-try-non-project-cache
> 'append))
>
>   ;; customized project current name function that respects
>   ;; non-project marker and returns nil if a non-project
>   (defun my/project-current-name (&optional buf)
>     "Return the current project name for BUF, or nil if a non-project.
> If BUF is nil, the current buffer is used."
>     (with-current-buffer (or buf (current-buffer))
>       (when-let* ((p (project-current))
>                   (pn (project-name p)))
>         (unless (string= pn my:project--non-project-dir)
>           pn))))
> ...
> )
>
> On Thu, Oct 10, 2024 at 8:38 PM Dmitry Gutov <dgutov@yandex.ru> wrote:
>
>> On 09/10/2024 19:10, Juri Linkov wrote:
>> > Or maybe better to cache the value of project-name on remove projects.
>>
>> Just the project->project-name mapping? Why not. I suppose there'd still
>> be a pause when switching projects, but it's not as bad.
>>
>> For general caching, from past threads it seems the most problematic
>> case is "no project". Because OT1H it's still costly it terms of remote
>> I/O. But on the other, this is exactly when the cache might get invalid
>> soon (because the user will initialize a Git repo, or create another
>> root marker, etc).
>>
>> I guess we should come back to this after bug#72300.
>>
>>
>>
>>

[-- Attachment #2: Type: text/html, Size: 4203 bytes --]

  reply	other threads:[~2024-10-13 13:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <874j5lzhdn.fsf.ref@aol.com>
2024-10-09 10:43 ` bug#73718: 31.0.50; Severe performance issue with Tramp and project-mode-line-format Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-09 13:12   ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-10 11:12     ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-09 13:38   ` Dmitry Gutov
2024-10-09 13:45     ` Ship Mints
2024-10-09 14:01       ` Ship Mints
2024-10-09 16:10     ` Juri Linkov
2024-10-11  0:38       ` Dmitry Gutov
2024-10-11 14:35         ` Ship Mints
2024-10-13 13:31           ` Ship Mints [this message]
2024-10-10  9:57     ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-11  0:33       ` Dmitry Gutov
2024-10-11 11:45         ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAN+1Hbp5c3yhPhKY6RDCEWjWAgUHeUhnKcK-KSNcaDpKkZnq5g@mail.gmail.com \
    --to=shipmints@gmail.com \
    --cc=73718@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=juri@linkov.net \
    --cc=michael.albinus@gmx.de \
    --cc=spacibba@aol.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).