From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Hi-Angel Newsgroups: gmane.emacs.help Subject: Re: Lexical binding doesn't seem to be faster? Date: Sun, 10 Mar 2019 18:16:04 +0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="252983"; mail-complaints-to="usenet@blaine.gmane.org" Cc: help-gnu-emacs@gnu.org To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Mar 10 16:16:33 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 1h30Bl-0013fP-0N for geh-help-gnu-emacs@m.gmane.org; Sun, 10 Mar 2019 16:16:33 +0100 Original-Received: from localhost ([127.0.0.1]:46183 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h30Bj-0007HH-PC for geh-help-gnu-emacs@m.gmane.org; Sun, 10 Mar 2019 11:16:31 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:44594) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h30BV-0007Gx-J1 for help-gnu-emacs@gnu.org; Sun, 10 Mar 2019 11:16:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h30BU-0007kV-IC for help-gnu-emacs@gnu.org; Sun, 10 Mar 2019 11:16:17 -0400 Original-Received: from mail-it1-x130.google.com ([2607:f8b0:4864:20::130]:40620) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h30BU-0007jv-Aa for help-gnu-emacs@gnu.org; Sun, 10 Mar 2019 11:16:16 -0400 Original-Received: by mail-it1-x130.google.com with SMTP id l139so3434431ita.5 for ; Sun, 10 Mar 2019 08:16:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BJNqq9eXZ3mhzU7dpd5ud5rJYKO0fb9rWZrahFivwPI=; b=JjR+BlNYeXZjuuh0X89pywwmEcUf5gqaMhz1kxa4CeJBaq4CIYXOkpNa0YLCc8Ckzb 4v84X8Lf4LyPV92Jet/BMfuKQ/J0fh6ecRjnD8mlYnWlqtxKT8zY2oD5jqgDsfATDsAy F8KwoQxb6FCL/4Evl9MDte3/PDKbCIcas63XuJw5mWtoBBKwmrm0c1qHtHjk0TfDgR2j 6jCmzYxaHsJQFxmDPmz0zvjkKL6Qcvg8MJeXVCwJFjxUX1e+hJ5z/gYW72zl5dmvEF8d 7rvq26ADhADUeIthJwHksNmSRf6hn3S+3aqFEcTlshP8fjk8gQtSbAaixblC83Y0e6NB g4DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BJNqq9eXZ3mhzU7dpd5ud5rJYKO0fb9rWZrahFivwPI=; b=RfEL/iuHICQLCE9FKAORig1iDFMb87lG86jxXZBwkGYwQio5Gb0d2ePlq9zs1xHibt iNNaXoZS76mcDDpyX3v0zY7KhyJlz4E1A9cNssSC4/i7m+cTlgcLYIgDRY4ybyQB1fhs vY8N9jqcjYAQUAkxTY+M1KA8p3p/oa8lZsiAjm7dWjTUP298iCpdNLXbhDkdmv/Y5RvY NJiKGHpi5vSUlc99TNp+ZvnEsX3CcNuxBYzgoeiiUbphzUAW7KK5AdJYgeWKB9/3c6W4 +wAB8eECn0L0W2+Xl/kN0IREGpLzLk/Yrik7mTVNK4gi8TZwA8ntjSHOSF1VqpWbKQxt lFvQ== X-Gm-Message-State: APjAAAWnhzRYitERLvM5wZOMmcq9CkkZTjAqf/EMS9nX4lTJk5BH6rls AEKf9spEL+o6RpLk3iBthKFBGWJSU43IeM8s9XQ= X-Google-Smtp-Source: APXvYqyHIJ4OZMEfwnrHIFanRAFQd0tDsctf7V7IepSy4mwQhSUK5JkLv/1y8SPkayF62rFoITke5ADYn12y641Atb8= X-Received: by 2002:a24:3546:: with SMTP id k67mr13656538ita.82.1552230975298; Sun, 10 Mar 2019 08:16:15 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::130 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:119598 Archived-At: On Sat, 9 Mar 2019 at 18:06, Stefan Monnier wrote: > > 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). Thanks, so, I did that, and without disabling GC results look quite odd. For "lexical-binding: t" it is: - ... 2 100% - list 1 50% - - 1 50% - let 1 50% - let 1 50% - while 1 50% - funcall 1 50% - # 1 50% - c-font-lock-fontify-region 1 50% - c-before-context-fl-expand-region 1 50% - mapc 1 50% - # 1 50% - c-context-expand-fl-region 1 50% - c-fl-decl-end 1 50% - c-literal-start 1 50% - c-state-semi-pp-to-literal 1 50% c-parse-ps-state-below 1 50% Automatic GC 1 50% Whereas for "lexical-binding: nil" it's just: - ... 1 100% Automatic GC 1 100% ----- With GC disabled it looks more interesting: "lexical-binding: t": - ... 1 100% - list 1 100% - - 1 100% - let 1 100% - let 1 100% - while 1 100% - funcall 1 100% - # 1 100% - c-font-lock-fontify-region 1 100% - c-before-context-fl-expand-region 1 100% - mapc 1 100% - # 1 100% - c-context-expand-fl-region 1 100% - c-fl-decl-end 1 100% - c-literal-start 1 100% - c-state-semi-pp-to-literal 1 100% c-parse-ps-state-below 1 100% Automatic GC 0 0% "lexical-binding: nil": - ... 1 100% - funcall-interactively 1 100% - eval-expression 1 100% - eval 1 100% - mytest 1 100% - let 1 100% - list 1 100% - - 1 100% - let 1 100% - let 1 100% - while 1 100% - funcall 1 100% - # 1 100% - c-font-lock-fontify-region 1 100% - font-lock-default-fontify-region 1 100% - font-lock-unfontify-region 1 100% font-lock-default-unfontify-region 1 100% Automatic GC 0 0%