From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#70036: 30.0.50; Move file-truename to the C level Date: Thu, 28 Mar 2024 12:41:08 +0100 Message-ID: <875xx6y46j.fsf@thornhill.no> References: <87le63xzjt.fsf@thornhill.no> <87jzlmd831.fsf@localhost> <87v856wrj1.fsf@thornhill.no> <87r0futxj4.fsf@localhost> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15587"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70036@debbugs.gnu.org To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 28 12:42:23 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1rpo9G-0003n1-RJ for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 28 Mar 2024 12:42:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rpo8y-0008Cm-60; Thu, 28 Mar 2024 07:42:04 -0400 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 1rpo8w-0008Bu-Au for bug-gnu-emacs@gnu.org; Thu, 28 Mar 2024 07:42:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rpo8w-0002Oc-2j for bug-gnu-emacs@gnu.org; Thu, 28 Mar 2024 07:42:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rpo8w-0008EO-6F for bug-gnu-emacs@gnu.org; Thu, 28 Mar 2024 07:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 28 Mar 2024 11:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70036 X-GNU-PR-Package: emacs Original-Received: via spool by 70036-submit@debbugs.gnu.org id=B70036.171162608531480 (code B ref 70036); Thu, 28 Mar 2024 11:42:02 +0000 Original-Received: (at 70036) by debbugs.gnu.org; 28 Mar 2024 11:41:25 +0000 Original-Received: from localhost ([127.0.0.1]:39223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rpo8K-0008Bg-IR for submit@debbugs.gnu.org; Thu, 28 Mar 2024 07:41:24 -0400 Original-Received: from out-184.mta1.migadu.com ([95.215.58.184]:26337) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rpo8G-0008Aj-Ny for 70036@debbugs.gnu.org; Thu, 28 Mar 2024 07:41:22 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1711626073; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3b0JR+VrbMtbW4J14nJrHwQeZgm1Yx807o4y4k0m4ok=; b=BEqt0xVVdvTxL7AM6KOeFtvIYOGRvVuQX5H1TZvMfxmqclM9BPlGx1YsqCqHJYaiUoaYYs syv7aCWCZZQxwY47+mmh2Ob23eEr70pduu0eRlzhqPPLXBIxde60tZJEE23yyB7HkzSONC 7/eg8C4WINFEIp/48GYGRB6GbJqHfBuzcfFZD84TexQjAXKczOw3vmRu4MPGwHeWenbqZE QNq5Z/67mMMeqjEPSwSkACVvRf/TCsXkKqMoE/MamEzNJbAiryZ8KWRiMezEnXvPc4QJqL a73mEFX0wKUS0vkNuzriGhoUCWOS3rrW/wq7qQuT+INDZsuHihk71tx+KeJM5Q== In-Reply-To: <87r0futxj4.fsf@localhost> X-Migadu-Flow: FLOW_OUT X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:282215 Archived-At: Ihor Radchenko writes: > Theodor Thornhill writes: > >> Not sure I understand what you mean. I tried it again, but this time the >> call is 100000 times and in an existing file on my system which is >> deeply nested. I run emacs with `emacs -Q` from a build on >> `30b1b0d7cd8e4d46a601e9737350cda970f6bab0`. >> >> the relevant part from the profile this time: >> ``` >> 15478 72% - command-execute >> 15440 72% - funcall-interactively >> 15439 72% - eval-last-sexp >> 15439 72% - # >> 15439 72% - elisp--eval-last-sexp >> 15436 71% - eval >> 15436 71% - benchmark-call >> 15434 71% - # >> 15434 71% - file-truename >> 13536 63% - file-truename >> 12224 57% - file-truename >> ... >> To me this looks like it spends a lot of time in recursive calls > > No. It is just that your `file-truename' is native-compiled and the > profiler is unable to get the details from inside native subr code. > > You can re-evaluate the defun to reveal the details in the profiler > output. Or use Emacs compiled without native-compilation support. > > -- > Ihor Radchenko // yantar92, > Org mode contributor, > Learn more about Org mode at . > Support Org development at , > or support my work at I'm sorry, but I don't see the real difference here. Yes, the profile is more detailed this way, but it doesn't change the fact that file-truename is slow, does it? The question to me is whether or not this is an acceptable performance hit to take for eglot given what it's trying to do, and my opinion is no. Whether or not it should be moved to C is open to suggestion. I'm preparing a patch that only targets Eglot by removing reliance on this function. Theo ``` 17839 63% - command-execute 17794 63% - funcall-interactively 17793 63% - eval-last-sexp 17793 63% - # 17793 63% - elisp--eval-last-sexp 17791 63% - eval 17791 63% - benchmark-call 17788 63% - # 17783 63% - file-truename 17576 62% - let 17546 62% - while 17529 62% - let 17358 61% - if 17356 61% - let 16365 58% - or 15969 56% - if 15964 56% - let 15951 56% - file-name-as-directory 15824 56% - file-truename 15788 56% - let 15768 56% - while 15712 55% - let 15579 55% - if 15577 55% - let 7224 25% - or 3429 12% - if 3325 11% - let 3059 10% - file-name-as-directory 1866 6% - file-truename 1501 5% - let 1276 4% - while 1121 3% - let 1004 3% find-file-name-handler 18 0% if 49 0% - setcar 26 0% 1- 37 0% - if 23 0% < 36 0% not 97 0% - if 46 0% - eq 8 0% quote 7 0% or 218 0% - cond 112 0% - and 95 0% - string= 73 0% substring 82 0% - or 57 0% string= 17 0% or 123 0% - setcar 83 0% - cons ```