emacs-devel
[Top][All Lists]
Advanced

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

Re: CC Mode -> Tree sitter challenge


From: Stefan Monnier
Subject: Re: CC Mode -> Tree sitter challenge
Date: Sat, 05 Nov 2022 10:34:25 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> We usually use something like the below:
>
>   (defun scroll-up-benchmark ()
>     (interactive)
>     (let ((oldgc gcs-done)
>         (oldtime (float-time)))
>       (condition-case nil (while t (scroll-up) (redisplay))
>       (error (message "GCs: %d Elapsed time: %f seconds"
>                       (- gcs-done oldgc) (- (float-time) oldtime))))))
>
>   (defun scroll-up-by-40-benchmark ()
>     (interactive)
>     (let ((oldgc gcs-done)
>         (oldtime (float-time)))
>       (condition-case nil (while t (scroll-up 40) (redisplay))
>       (error (message "GCs: %d Elapsed time: %f seconds"
>                       (- gcs-done oldgc) (- (float-time) oldtime))))))

See also the `elisp-benchmark` package, especially its
`benchmarks/elb-scroll.el` which shows how to do that in batch mode.

We could tweak that file to define not just `elb-scroll-entry` but also
`elb-cc-scroll-entry` to compare the time between the use of
`elb-smie-mode` (whose purpose is not to show how it compares to
CC-mode's C mode but rather to have a non-varying code across Emacs
versions, so we can see the effect of other factors than the mode
itself) and CC-mode's `c-mode` and another using your new `c-mode`.


        Stefan




reply via email to

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