From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Lexical binding doesn't seem to be faster? Date: Sat, 09 Mar 2019 10:06:28 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="24364"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: help-gnu-emacs@gnu.org To: Hi-Angel Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Mar 09 16:06:57 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h2dYt-0006Ca-QV for geh-help-gnu-emacs@m.gmane.org; Sat, 09 Mar 2019 16:06:55 +0100 Original-Received: from localhost ([127.0.0.1]:60104 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2dYs-00065d-PP for geh-help-gnu-emacs@m.gmane.org; Sat, 09 Mar 2019 10:06:54 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:55265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2dYX-00064Y-5S for help-gnu-emacs@gnu.org; Sat, 09 Mar 2019 10:06:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h2dYV-0008BZ-Ij for help-gnu-emacs@gnu.org; Sat, 09 Mar 2019 10:06:33 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:59334) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2dYV-00089n-CX for help-gnu-emacs@gnu.org; Sat, 09 Mar 2019 10:06:31 -0500 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id x29F6SPS026529; Sat, 9 Mar 2019 10:06:28 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 63FBD6AA48; Sat, 9 Mar 2019 10:06:28 -0500 (EST) In-Reply-To: (Hi-Angel's message of "Fri, 8 Mar 2019 16:33:50 +0300") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6499=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6499> : inlines <7030> : streams <1815213> : uri <2809627> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:119593 Archived-At: > Ah, thanks! Previously I only found `benchmark` function, but running > > (benchmark 10 (c-font-lock-fontify-region 0 (point-max))) > > results in error "void-function jit-lock-bounds". With `benchmark` you need to quote the argument (it's a function, not a macro). [ BTW, (point-min) is more better than 0. ] > FTR: I re-benchmarked as `(benchmark-run-compiled 10 > (c-font-lock-fontify-region 0 (point-max)))`, and also with `emacs -Q` > to make sure that none of addons can interfere (I'm using > color-identifiers which may add an overhead to fontification). For the > same reason I disabled GC (locally I too have it only enabled to run > at "idle time"). Good (except for disabling GC, which makes the measurement different from "real life"). > It's interesting that the difference almost disappeared: > > nil: (7.463936164 0 0.0) (7.520960622 0 0.0) (7.526411695999999 0 > 0.0) (7.537842362999999 0 0.0) > t: (7.617106151000001 0 0.0) (7.635044875 0 0.0) > (7.6383228789999995 0 0.0) (7.598431915 0 0.0) > > "nil" still seems to be faster, but it may as well be a statistical variation. It looks minor but it seems stable enough to be more than just statistical variation. > Either way, I'm happy, as you suggested, to look at per-function > overhead to see if there's any difference. Do you think it's still > worth it? Hard to tell. > And how do I do it though? Shall I do (profiler-start), and > then evaluate the benchmark? Do (profiler-start 'cpu) before running the benchmark and (profiler-report) afterwards. And then C-u RET on the top line to expand it (recursively). Stefan