emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH]: Add new bytecode op `switch' for implementing branch tables


From: Clément Pit-Claudel
Subject: Re: [PATCH]: Add new bytecode op `switch' for implementing branch tables.
Date: Tue, 7 Feb 2017 10:56:49 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0

On 2017-02-07 08:50, Vibhav Pant wrote:
> On Tue, Feb 7, 2017 at 12:00 AM, Stefan Monnier
> <address@hidden> wrote:
>>> The following patch adds support for a new op `switch` to the Emacs
>>> bytecode VM and compiler.
>>
>> I guess the motivation is to speed up some code.
>> Did you make any measurements to see what kind of effect it has?
> 
> The attached benchmark code took 9.409541956 seconds when compiled
> without switch,
> and 0.20807168799999998 seconds (97% speedup) when compiled with switch. It
> generates a cond clause with a thousand clauses comparing a variable
> with random integer values, with the last clause containing the actual
> value. However,
> since it's a synthetic benchmark, real world code should be better indicator 
> of
> performance improvement.

I've attached another benchmark, which evaluates arithmetic expressions.  On 
this, byte-switch seems to be a bit slower:

    $ rm -f *.elc; emacs-byte-switch -Q --batch --eval '(byte-compile-file 
"eval-expr.el")'; time emacs-byte-switch -Q --batch -L . -l benchmark-expr.el

    real        0m4.193s
    user        0m4.188s
    sys 0m0.000s

    $ rm -f *.elc; emacs-master -Q --batch --eval '(byte-compile-file 
"eval-expr.el")'; time emacs-master -Q --batch -L . -l benchmark-expr.el

    real        0m3.956s
    user        0m3.944s
    sys 0m0.008s

The timings fluctuate quite a bit, but the byte-switch branch seems to be about 
5-7% slower.  Hopefully linear-scan hash tables will make things much faster :)

Thanks for your work on this!

Cheers,
Clément.

Attachment: benchmark-expr.el
Description: Text Data

Attachment: eval-expr.el
Description: Text Data


reply via email to

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