From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#69480: Emacs Lisp needs, for its great 'native-compile', 'declare' and 'the' for fixnums and arrays. Date: Fri, 01 Mar 2024 20:36:24 +0100 Message-ID: <87il25u4lj.fsf@gmx.net> References: <86edcvrpzg.fsf@gnu.org> <87bk7yur6p.fsf@gmx.net> <877cimuo5n.fsf@gmx.net> <86msriqfws.fsf@gnu.org> <8734tauml5.fsf@gmx.net> <86jzmmqdbv.fsf@gnu.org> <87y1b2t5wx.fsf@gmx.net> <87ttlqt3z6.fsf@gmx.net> Reply-To: Stephen Berman Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34220"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: robertstephenboyer@gmail.com, Eli Zaretskii , 69480@debbugs.gnu.org To: Andrea Corallo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Mar 01 20:37:50 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 1rg8hZ-0008fh-1M for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 Mar 2024 20:37:49 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rg8hL-0000Wa-NQ; Fri, 01 Mar 2024 14:37:35 -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 1rg8hK-0000WD-23 for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2024 14:37:34 -0500 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 1rg8hJ-0003HO-QG for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2024 14:37:33 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rg8hl-0005pn-MC for bug-gnu-emacs@gnu.org; Fri, 01 Mar 2024 14:38:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Mar 2024 19:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69480 X-GNU-PR-Package: emacs Original-Received: via spool by 69480-submit@debbugs.gnu.org id=B69480.170932182222344 (code B ref 69480); Fri, 01 Mar 2024 19:38:01 +0000 Original-Received: (at 69480) by debbugs.gnu.org; 1 Mar 2024 19:37:02 +0000 Original-Received: from localhost ([127.0.0.1]:37509 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rg8gn-0005o9-Vs for submit@debbugs.gnu.org; Fri, 01 Mar 2024 14:37:02 -0500 Original-Received: from mout.gmx.net ([212.227.17.21]:39041) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rg8gl-0005nj-6g for 69480@debbugs.gnu.org; Fri, 01 Mar 2024 14:37:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1709321785; x=1709926585; i=stephen.berman@gmx.net; bh=IVBxidT+Nj+g08EC0IQdO4NKs9sk+JmHo2JNFcSe3so=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References: Date; b=crhcL2QiwIetIogi8359pMIvCjgOGUq4FMsvDrfxjmCeTgJnjTq8xRzXKXTUmkc9 Bg4gwiIoRxl8TC7yZJDNBY0h6/BgCKio9tbmyftEkE9UYPanlFUZFfDYOFOvt6ygS AQB+q3FyFlWgK184o+qQB+DjUfM/L39u8IwwlXlPj5j2LnjJQoypN+hTVbX3TH6IP QQpr0hVsP+Y/X5AkFKJUq3g3vLpkj8GDOK1vydURoROlHTuCGynSuQvXf+s6bf25T cn6EoxWmeWeVdMew+sYFo5P8lfRHy9AddV1b7kIN9RPl19xsuEAfV3/wze6UP0m5a tnttGleT+OT2eBh6Lw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from strobelfs2 ([94.134.94.185]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1McpNy-1r6WkM422U-00ZuyC; Fri, 01 Mar 2024 20:36:25 +0100 In-Reply-To: (Andrea Corallo's message of "Fri, 01 Mar 2024 11:10:21 -0500") X-Provags-ID: V03:K1:Ey6OGBId3wGBqMYY9xfUMHZzW9QxemdrTWOnJgYhoMbc1SerS+6 F+FPO5NlB0tOd7Yf08EmH0XJdfR+O6uZPk9UWqoZ67H+fvyhVaUA9Z2CoohG1j/vmo0RE1D KBXm52k/42ErBwnjIZhR9VCce8KoUorXQuZWmdhQ2DZ/+VQnzdbF7KgTzJydxSYLI0anQmY GPhfNyOOs6OZMEkXO+qCg== UI-OutboundReport: notjunk:1;M01:P0:lPnVWACHoMk=;euIMTcJW+RJzDnNEji6J/N0oWbg QGvhxE7vgO6N5fvHsxBvWvDxXLp5N7jmYRyXg4lBjJqn0CnvtC3KRxbJBuNcrWYpvcPMZSbFh pmRwENKXqn3DdEyj+jo4ZHs1Q5bahwOuLMfU9sO3dyba9FBThWvpuXy6ceSTWTlDSVUUml4l8 zJ4sD5CGBO+zxWYhByDgfhKiCAuzfOICS1XBvAI5L1q1fOiTcGnl+08QRcVBsUsZhp+8KGWjz BemFfGNG5/7mgTqAis9RaXA9kKBbsxhP8kXw8Jfm1iDRPaiJrJZ2fFCUTJ5kZ+pYrNUHAP3yU 9eOmIBmXryvUWP+Jjrp8xAJjQBBDypl1vtO6d+vc/ENgzA9IHqRwpudegoF3R9pqz1GGgt1Ag tBf5PDj98v26cexFs6XHTh9A8C2r6XBCkdZwQfpJg/sGwy2vPfxjOQMrsyeTZhq26V5M87bt6 DMeO3xM5vuHnY6PrcJ7kJ5Jp7ASB2xSo0yktm2yvTGRUtBtXHVksvCfDp6hepeBulkwWhivfB wYnzV8f3LUlWYe/JiJAtzFgVLoQDPdKDMP6vXLgPk1WQU6MCMysTmXnuqipfJjELEuh/2ddjd QN9ZQC/Ag3bw39XFoal9C2FAzdPJdB+dMcvG69IOqTGWgpVgCUtW8/TR//ljL3oY1vFGflB8W lEQW0eGsh/z9QypifBKwXU5Uz8NEpBkU6hPYIdImTkg2EHrJkhR2Dt5Ykds65uWR3+vnV9CF5 VLLxoFEiXrE3G+PALTW57SP1WBGGi0jUC0HmD0DyKIcQ1jutnh8170IGkeWAzvpq3Qeu/k8N 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:280872 Archived-At: On Fri, 01 Mar 2024 11:10:21 -0500 Andrea Corallo wrote: > Stephen Berman writes: > >> On Fri, 01 Mar 2024 09:07:54 -0500 Andrea Corallo wrote: >> >>> Stephen Berman writes: >>> >>>> On Fri, 01 Mar 2024 15:41:24 +0200 Eli Zaretskii wrote: >>>> >> [...] >>>>> My suggestion was to compare profiles in the byte-compiled and >>>>> native-compiled cases. >>>>> >>>>> Btw, are you running both cases in the same session? If so, don't: >>>>> restart Emacs and run the other case instead. >>>> >>>> Ok, I've now done that. Here's the report for the run with native >>>> compilation: >>>> >>>> 12599 95% - command-execute >>>> 12487 95% - funcall-interactively >>>> 12486 95% - eval-expression >>>> 12485 95% - # >>>> 12485 95% - # >>>> 12480 95% - eval >>>> 12480 95% - progn >>>> 12367 94% - benchmark-call >>>> 12367 94% - # >>>> 12367 94% build-sieve >>>> 113 0% - emacs-lisp-native-compile-and-load >>>> 113 0% - emacs-lisp-native-compile >>>> 113 0% - native-compile >>> >>> IIUC this is profiling the native compilation itself. >>> >>> BTW I'd suggest the profile is done with perf (and running batch). >> >> I don't have perf installed, but I build the kernel from source, so I >> guess I could build and install perf, but... >> >>> Given you see on your machine similar times for native and byte compiled >>> the expected outcome should be tha tthe time is spent in some C routine >>> of our core. >> >> If you consider ~12.7 (native-compiled) and ~9.6 (byte-compiled), >> similar for this benchmark, and since Eli said it's expected that >> native-compiled elisp can be slower than byte-compiled elisp for some >> programs, then I guess I can just accept that for this case, the >> difference between my timings is within a reasonable margin of error and >> not due to some problem with my libgccjit (which I also built and >> installed myself). > > I doubt the correctness of your measure. Some points: > > 1- Your benchmark results shows you are measuring the compilation > process as well. Yes, this was due to my misunderstanding of the doc string of emacs-lisp-native-compile-and-load. > 2- As Eli mentioned you should always start from on a freshly started > session (probably running batch). I did start a fresh session in the above, though not a batch run. > 3- You should also do several measures of the same test to estimate the > noise and, as consequence, the accuracy of your measure. The reason is > that there are many sources of noise on a running system (OS, paging, > CPU throttle due to thermal conditions etc...). These sources of noise > can have a big impact. I know, though I have now done several runs using emacs-lisp-native-compile-and-load, all resulting in nearly the same timing, and my corrected run after simply loading the natively compiled file also resulted in virtually the same time (see my reply to Eli). Maybe it's still not an accurate measurement, but can it be so inaccurate as to result in a 1/3 slower time than the byte-compiled run? Steve Berman