From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Speed up project-kill-buffers Date: Mon, 03 May 2021 18:45:29 -0400 Message-ID: References: <87mttcgnke.fsf@posteo.net> <477b600f-a69c-179a-20e7-db60c2539599@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24223"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Philip Kaludercic , emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue May 04 00:52:58 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 1ldhQv-0006AV-GH for ged-emacs-devel@m.gmane-mx.org; Tue, 04 May 2021 00:52:57 +0200 Original-Received: from localhost ([::1]:33858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldhQu-000480-HF for ged-emacs-devel@m.gmane-mx.org; Mon, 03 May 2021 18:52:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldhJp-0004oJ-8q for emacs-devel@gnu.org; Mon, 03 May 2021 18:45:38 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:40686) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldhJm-0008Cn-K9 for emacs-devel@gnu.org; Mon, 03 May 2021 18:45:36 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id BF9AA100216; Mon, 3 May 2021 18:45:32 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 21609100091; Mon, 3 May 2021 18:45:31 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1620081931; bh=md0hQbodSIJXtkXLqCEFYDGGPGCH1o4pg0ouextPrXo=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=L5cUgjKbPQTffqPxcd8eXz7OVHHwI6wxYkFozOg348CIBuy2zO6ikl3shWkWwSKMl WxWYW4xzpBbho8mDSQ7c3dHE/p1UJ/51Hp8l6/SRuxBO5qgGsSaNRDnYChjqS9XGMp 8cjYavKN3AG1TlajAN6KJYy5nozBcz7BmoThf5EXYwxthcAB+e4eY+kIm3OBtY+tBY 7GnHmnfiEZv9K1Df9waf5T2YS/29p38C/FV0RZixaW5Bko+CxynRZxlqzwr8sIwYAU ojzBadAhYM28k2QsqmjsgjyAk28uXtHHeJjRKguqs1SzEyKR0/51JDHxk8jMdOxRTG JBdDjWv9Z+Irg== Original-Received: from alfajor (76-10-140-76.dsl.teksavvy.com [76.10.140.76]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id D6B001201B6; Mon, 3 May 2021 18:45:30 -0400 (EDT) In-Reply-To: <477b600f-a69c-179a-20e7-db60c2539599@yandex.ru> (Dmitry Gutov's message of "Tue, 4 May 2021 00:43:03 +0300") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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:268853 Archived-At: >> I've noticed that sometimes project-kill-buffers is noticeably slow, and >> it seems like it's has to do with project--buffer-list working on remote >> files. The function goes through every buffer and calls >> (project-current), even if the buffer is related to a remote file that >> cannot be part of the current project. >> The patch I attach below is a simple fix to avoid checking files that >> cannot be part of the current project. Or are there any edge-cases that >> this code approach breaks? > > In theory, files on different hosts could be part of the same "project" (in > Eli's sense, see > https://lists.gnu.org/archive/html/emacs-devel/2020-07/msg00051.html and the > other messages in that thread), but we'll get there when we get > there. Probably by adding a method like project-contains-file-p. Of course, we could also make the check super fast by keeping the "current project" in a buffer-local var, and then just look for buffers which have an `eq` value in that var. That would be both faster than `file-in-directory-p` and more arguably more correct. Stefan