[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Lexical binding doesn't seem to be faster?
From: |
Hi-Angel |
Subject: |
Re: Lexical binding doesn't seem to be faster? |
Date: |
Sun, 10 Mar 2019 18:16:04 +0300 |
On Sat, 9 Mar 2019 at 18:06, Stefan Monnier <monnier@iro.umontreal.ca> 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%
- #<compiled 0x15833de3b0c9> 1 50%
- c-font-lock-fontify-region 1 50%
- c-before-context-fl-expand-region 1 50%
- mapc 1 50%
- #<compiled 0x15833db80701> 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%
- #<compiled 0x1585968733a1> 1 100%
- c-font-lock-fontify-region 1 100%
- c-before-context-fl-expand-region 1 100%
- mapc 1 100%
- #<compiled 0x158596934cbd> 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%
- #<compiled 0x1580e938690d> 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%
- Lexical binding doesn't seem to be faster?, Hi-Angel, 2019/03/06
- Re: Lexical binding doesn't seem to be faster?, Stefan Monnier, 2019/03/08
- Re: Lexical binding doesn't seem to be faster?, Hi-Angel, 2019/03/08
- Re: Lexical binding doesn't seem to be faster?, Stefan Monnier, 2019/03/09
- Re: Lexical binding doesn't seem to be faster?,
Hi-Angel <=
- Re: Lexical binding doesn't seem to be faster?, Hi-Angel, 2019/03/10
- Re: Lexical binding doesn't seem to be faster?, Stefan Monnier, 2019/03/10
- Re: Lexical binding doesn't seem to be faster?, Hi-Angel, 2019/03/10
- Re: Lexical binding doesn't seem to be faster?, Stefan Monnier, 2019/03/10
- Re: Lexical binding doesn't seem to be faster?, Hi-Angel, 2019/03/10
- Re: Lexical binding doesn't seem to be faster?, Stefan Monnier, 2019/03/10
- Re: Lexical binding doesn't seem to be faster?, Hi-Angel, 2019/03/10
- Re: Lexical binding doesn't seem to be faster?, Hi-Angel, 2019/03/11
- Re: Lexical binding doesn't seem to be faster?, Stefan Monnier, 2019/03/11