emacs-pretest-bug
[Top][All Lists]
Advanced

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

RE: (describe-function 'self-insert-command) takes too long


From: Drew Adams
Subject: RE: (describe-function 'self-insert-command) takes too long
Date: Sat, 14 Oct 2006 11:21:05 -0700

I said:

        It looks like this change was already made and the comment is
        obsolete.

    I just compared the latest CVS version of describe-function-1
    with the one in my build, and there is no difference. To me,
    that means that the problem still exists.

    The problem might not be at that comment, actually. It looks
    like the complete set of keys is computed, and then it is
    simply not all printed if the number is too great. That saves
    printing space, but not time (not much).

    The list of keys should not be completely computed in the first
    place - just computed up to some reasonable limit. (And perhaps
    let programs bind that limit as a variable?)

    There is no noticeable delay even for commands bound to a few
    dozen keys, but self-insert-command is bound to zillions of
    them. It is essentially a special case that needs to be treated
    as such, or else, as I say, the list of keys should be computed
    only up to some limit.

Some more info on this, FYI: In my build, on my machine, measuring using
this (thanks, Lennart) gives 0.701 seconds (IIUC):

(let ((t1 (get-internal-run-time)) t2)
  (describe-function 'self-insert-command)
  (setq t2 (get-internal-run-time))
  (message "%s %s" t1 t2))

=> (17713 7329 73000) (17713 7329 774000)

Doing the same thing for command `forward-char' gives 0.05 seconds:

=> (17713 7521 950000) (17713 7521 960000)

That's an order of magnitude difference (factor of 14). And 0.7 seconds
renders this essentially non-interactive, especially when combined with the
possible overhead of other processing (e.g. calling describe-function from
another command).

Besides, all of that processing time is simply wasted, since the calculated
key bindings are just thrown away, replaced by the "many ordinary text
characters" help. The code should be smarter than that.






reply via email to

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