help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lexical binding doesn't seem to be faster?


From: Stefan Monnier
Subject: Re: Lexical binding doesn't seem to be faster?
Date: Sat, 09 Mar 2019 10:06:28 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]