From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "T.V Raman" Newsgroups: gmane.emacs.devel Subject: Re: file-remote-p being called too often? Date: Thu, 18 Jan 2024 06:43:23 -0800 Message-ID: <26025.14603.477732.923178@retriever.mtv.corp.google.com> References: <0eaa7499-dc5e-4bc5-828d-2465b23bc586@orange.fr> <83bk9jb3l5.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3190"; mail-complaints-to="usenet@ciao.gmane.io" Cc: raman@google.com, da_vid@orange.fr, emacs-devel@gnu.org To: eliz@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jan 18 15:44:21 2024 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 1rQTcy-0000cq-W5 for ged-emacs-devel@m.gmane-mx.org; Thu, 18 Jan 2024 15:44:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQTcD-0002qv-PZ; Thu, 18 Jan 2024 09:43:33 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQTcA-0002qZ-1F for emacs-devel@gnu.org; Thu, 18 Jan 2024 09:43:30 -0500 Original-Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rQTc7-0006rS-8N for emacs-devel@gnu.org; Thu, 18 Jan 2024 09:43:28 -0500 Original-Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-29026523507so446889a91.0 for ; Thu, 18 Jan 2024 06:43:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1705589005; x=1706193805; darn=gnu.org; h=references:in-reply-to:subject:cc:to:date:message-id :content-transfer-encoding:mime-version:from:from:to:cc:subject:date :message-id:reply-to; bh=0m8uXPEjdfhcwvTFtpp6wMl2QRXoj0QPVLybrRALJDA=; b=1cMdw9sRce3RqPU3VnG/BWvYyZlVpj8w20huJ9B5Kpeyx/hmzyrJwr+nXkTX22I1Wl AQdxiXrkFeBNJIMvdaqY2EZAFkS+niVizPWEERxKYq8rrJIKnOMsM3X46rIShkOHvgHI zvodLUuHwiybgBsbyW+6j/Z1rOEMT64s/lmx4AK+OvbGus929lvoO01rwWVj3UJX0hQw 8XpWNI7Koupf62jLMMiLzzF0LnwQHXbcHz0TiVPpdt67WTyk9DPxyq7tAKingNsTwGFX JPWWuTneDPpNcIvo5n8g63Xgs4J2JNzd5URWzK8lBepWD8O6tuDleRwWQtVDSYFApJlr WXKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705589005; x=1706193805; h=references:in-reply-to:subject:cc:to:date:message-id :content-transfer-encoding:mime-version:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=0m8uXPEjdfhcwvTFtpp6wMl2QRXoj0QPVLybrRALJDA=; b=DWRlDtW5n2pjGYrIoCqWSMYKoDo6kHcF7SbgDybbMWuIGR5/pkVXcMOoo7ZTOb9q+S OzVV/dE5l43pq7bx+ZLHtPaj+aKFJ14TM2+BR4kjwFE0jtq+o/LwJND2Rrvy6dtab7j+ 4iibMRp81CtlRUbJgdNubJkvcZev1mWnYlYM7wWguCQmKfTUCJiG8Lg0Xc2Mnr+pVXcK TNjzCg+MXVQICrhWDqdWGbIxgMqWLbXrlIqLVr7apI0vHafQB+GSaOmx1bgztDOKuj0Q saKQD+xg6YGIDadyyPu4j4LNdAM8FDMXKbq6uLMRvk2iBDECT4bBcGMtzZC5miR7vQX9 gbVg== X-Gm-Message-State: AOJu0YxigYcbFklYWGtYxcm3pSB0Et7ayLUSg/PwlOVRl+Q0N64UinXF qwQ2INn4XyhBgFLPEaMf5h6VnfTbFeZB8FJ76PLzAREMiFtPbIT/DTfw0a6xOfkLjTKtW6lwBE7 UhA== X-Google-Smtp-Source: AGHT+IH9AtLx0rGPSlhZT9WiPxwQOhxGf8AK/Lu/eVYu4q8jkDigq0U6jJoscZRQYN49l8Pbp9BguQ== X-Received: by 2002:a17:90a:8d13:b0:28e:7b57:d219 with SMTP id c19-20020a17090a8d1300b0028e7b57d219mr778647pjo.92.1705589005232; Thu, 18 Jan 2024 06:43:25 -0800 (PST) Original-Received: from retriever.mtv.corp.google.com ([2620:15c:b5:1:8a2c:be36:e500:8cc7]) by smtp.gmail.com with ESMTPSA id sm9-20020a17090b2e4900b0028ffea988a2sm1948983pjb.37.2024.01.18.06.43.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 06:43:24 -0800 (PST) In-Reply-To: <83bk9jb3l5.fsf@gnu.org> X-Mailer: VM 8.1.1 under 30.0.50 (x86_64-pc-linux-gnu) Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=raman@google.com; helo=mail-pj1-x102d.google.com X-Spam_score_int: -193 X-Spam_score: -19.4 X-Spam_bar: ------------------- X-Spam_report: (-19.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, ENV_AND_HDR_SPF_MATCH=-0.5, NICE_REPLY_A=-1.748, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, USER_IN_DEF_DKIM_WL=-7.5, USER_IN_DEF_SPF_WL=-7.5 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:315087 Archived-At: thanks for the executable-find tip, yes I shall update to cache the value Eli Zaretskii writes: > > From: "T.V Raman" > > Cc: Emacs Devel , Eli Zaretskii > > Date: Wed, 17 Jan 2024 13:18:09 -0800 > > > > Above gets invoked when emacspeak plays a local audio file as an earcon > > using a shell command; there should be no reason to run file-remote-p in > > this case. > > > > Debugger entered--entering a function: > > * (file-remote-p "/home/raman/emacs/lisp/emacspeak/sounds/" localname) > > (file-local-name "/home/raman/emacs/lisp/emacspeak/sounds/") > > (executable-find "pactl") > > (emacspeak-sounds-get-file process-active) > > (emacspeak-play-auditory-icon process-active) > > (emacspeak-auditory-icon process-active) > > (emacspeak-speak-mode-line nil) > > Why does emacspeak repeatedly call executable-find, and from a > mode-line format on top of that? Why not call executable-find just > once, and then store the result in some variable, to be reused on > subsequent calls from emacspeak-speak-mode-line? > > In any case, for local file names, such as "pactl", the call to > file-remote-p should be very inexpensive. Do you have a reason to > believe it is somehow expensive in your case? Or did you just wonder > why file-remote-p is called that often, regardless of whether it's > expensive? The reason for frequent calls seems to be that you have > this call in your mode-line-format, which is not a good design. This > design means executable-find will be called every redisplay cycle, > time and time again, for the same program name, which is hardly a good > idea. --