[Top][All Lists]

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

Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text

From: Alan Mackenzie
Subject: Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'.
Date: Sat, 12 Mar 2016 19:36:26 +0000
User-agent: Mutt/1.5.24 (2015-08-30)

On Sat, Mar 12, 2016 at 07:46:39PM +0100, martin rudalics wrote:
>  > Possibly you're seeing the effect of emacs-25 commit
>  > 7352c6c695db8b90b63c2601277d64a32507d2bb, which was merged to master
>  > only in commit 63efcc268635dea78c6bd80749eae4ee2c72d717 (within the
>  > past 24 hours). If your master predates the later commit that could
>  > explain the symptoms you're seeing.

> I now repeated the experiments with latest master and still see the
> results I mentioned earlier.  That is, with the functions I gave
> earlier, the release branch is faster than master by a factor of 20!

> Could someone try to repeat with master _and_ release and post the
> results?

> (defun foo ()
>    (interactive)
>    (while (not (eobp))
>      (c-end-of-defun)))

> (defun bar ()
>    (interactive)
>    (while (not (bobp))
>      (c-beginning-of-defun)))

OK.  Here are my timings.  Just for the record I time things with this

    (defmacro time-it (&rest forms)
        "Time the running of a sequence of forms using `float-time'.
    Call like this: \"M-: (time-it (foo ...) (bar ...) ...)\"."
        `(let ((start (float-time)))
           (- (float-time) start)))

, rather than with elp, which will make my times a bit less.  I've timed
`foo' and `bar' on optimised builds in the emacs-25 branch and the
comment-cache branch (incorporating the patch I posted earlier).  Here
are the timings in seconds:

              emacs-25              comment-cache
foo            2.535                    1.651
bar           13.685                    1.620

These timings (apart from `bar' on emacs-25) are surely acceptable.

There's one subtlety about the comment-cache branch: I've now renamed
`comment-depth' (etc.) to `literal-cache' (etc.), and set
`literal-cacheing-flag' (renamed from `comment-cacheing-flag') to t by
default.  However, I've only just committed the corresponding required
change to CC Mode, so this might have a bearing on your timings.

Other than that, I can't explain what's going on with your timings.

> (defun foofoo ()
>    (interactive)
>    (elp-instrument-function 'c-end-of-defun)
>    (goto-char (point-min))
>    (foo)
>    (elp-results))

> (defun foobar ()
>    (interactive)
>    (elp-instrument-function 'c-beginning-of-defun)
>    (goto-char (point-max))
>    (bar)
>    (elp-results))

Just for the record:

               emacs-25               comment-cache
foofoo           2.545                   1.643
foobar          13.729                   1.642

> (find-file-noselect "../src/xdisp.c")
> (switch-to-buffer-other-window "xdisp.c")

> And in xdisp.c's window do M-x foofoo and M-x foobar.

> Thanks, martin

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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