>>> Bruce Stephens <bruce+cedet@...> seems to think that:
>"Eric M. Ludlam" <eric@...> writes:
>
>[...]
>
>> It is my opinion that the modification accounting part has been
>> optimized to nearly the best extent possible in Lisp code. One area
>> that may need some more assistance is dealing with bogus syntax
>> (such as an unterminated list or string) during an explicit reparse
>> request.
>
>That's matched by my experience: things are much faster now I've
>disabled idle-summary and idle-completion. (So I still have
>idle-decoration, which I think is pretty.)
>
>I've bound completion to a key, but it doesn't seem to work: probably
>this is just because (with the default settings) it's doing recursive
>searching through header files, and there are just too many of them
>for that to be practical. I'll have to experiment and see what's
>going on.
>
>I don't see a suitable function to bind to get the equivalent of the
>idle-summary information, which I'm missing. That looks easy to copy
>from semantic-idle.el.
You could try `semantic-ia-show-doc' which is new in CVS. It is
rougly the same, and shows the prototype and any handy commentary that
may be available. The semantic-ia functions are all prototypes of
things that eventually get expanded elsewhere, so I'd be interested in
your opinion.
>Maybe I could deactivate the idle stuff if Emacs seems idle for too
>long (10 seconds or something), only reactivating it when I do
>something? That feels like it might be easy to do (I haven't looked
>at the code closely enough to see, of course).
[ ... ]
Attached is a patch to semantic-idle.el which adds a verbosity flag.
Set the flag to t, and you can determine what is keeping things so
busy.
There is one new optimization I added while adding this, which is a
new cut-off to not reparse buffers if they don't need it. The comment
near that addition explains why.
Eric
*** semantic-idle.el 21 Sep 2004 07:52:13 -0400 1.29
--- semantic-idle.el 12 Feb 2005 11:08:51 -0500
***************
*** 1,6 ****
;;; semantic-idle.el --- Schedule parsing tasks in idle time
! ;;; Copyright (C) 2003, 2004 Eric M. Ludlam
;; Author: Eric M. Ludlam <zappo@...>
;; Keywords: syntax
--- 1,6 ----
;;; semantic-idle.el --- Schedule parsing tasks in idle time
! ;;; Copyright (C) 2003, 2004, 2005 Eric M. Ludlam
;; Author: Eric M. Ludlam <zappo@...>
;; Keywords: syntax
***************
*** 49,54 ****
--- 49,60 ----
(defvar semantic-idle-scheduler-timer nil
"Timer used to schedule tasks in idle time.")
+ (defcustom semantic-idle-scheduler-verbose-flag nil
+ "*Non-nil means that the idle scheduler should provide debug messages.
+ Use this setting to debug idle activities."
+ :group 'semantic
+ :type 'boolean)
+
(defcustom semantic-idle-scheduler-idle-time 2
"*Time in seconds of idle before scheduling events.
This time should be short enough to ensure that idle-scheduler will be
***************
*** 216,221 ****
--- 222,229 ----
(defun semantic-idle-core-handler ()
"Core idle function that handles reparsing.
And also manages services that depend on tag values."
+ (when semantic-idle-scheduler-verbose-flag
+ (working-temp-message "IDLE: Core handler..."))
(semantic-exit-on-input 'idle-timer
(let* ((inhibit-quit nil)
(buffers (delq (current-buffer)
***************
*** 246,252 ****
(save-excursion
(dolist (service semantic-idle-scheduler-queue)
(semantic-throw-on-input 'idle-queue)
! (funcall service)))))
;; Finally loop over remaining buffers, trying to update them as
;; well. Stop on keypress.
(save-excursion
--- 254,265 ----
(save-excursion
(dolist (service semantic-idle-scheduler-queue)
(semantic-throw-on-input 'idle-queue)
! (when semantic-idle-scheduler-verbose-flag
! (working-temp-message "IDLE: execture service %s..." service))
! (funcall service)
! (when semantic-idle-scheduler-verbose-flag
! (working-temp-message "IDLE: execture service %s...done" service))
! ))))
;; Finally loop over remaining buffers, trying to update them as
;; well. Stop on keypress.
(save-excursion
***************
*** 255,261 ****
(with-current-buffer b
(and (semantic-idle-scheduler-enabled-p)
(semantic-idle-scheduler-refresh-tags)))))
! )))
(defun semantic-idle-scheduler-function ()
"Function run when after `semantic-idle-scheduler-idle-time'.
--- 268,276 ----
(with-current-buffer b
(and (semantic-idle-scheduler-enabled-p)
(semantic-idle-scheduler-refresh-tags)))))
! ))
! (when semantic-idle-scheduler-verbose-flag
! (working-temp-message "IDLE: Core handler...done")))
(defun semantic-idle-scheduler-function ()
"Function run when after `semantic-idle-scheduler-idle-time'.
***************
*** 310,354 ****
Does nothing if the current buffer doesn't need reparsing."
! (let* ((semantic-working-type nil)
! (inhibit-quit nil)
! (working-use-echo-area-p
! (not semantic-idle-scheduler-working-in-modeline-flag))
! (working-status-dynamic-type
! (if semantic-idle-scheduler-no-working-message
! nil
! working-status-dynamic-type))
! (working-status-percentage-type
! (if semantic-idle-scheduler-no-working-message
! nil
! working-status-percentage-type))
! (lexically-safe t)
! )
! ;; Let people hook into this, but don't let them hose
! ;; us over!
! (condition-case nil
! (run-hooks 'semantic-before-idle-scheduler-reparse-hooks)
! (error (setq semantic-before-idle-scheduler-reparse-hooks nil)))
!
! (unwind-protect
! ;; Perform the parsing.
! (when (semantic-lex-catch-errors idle-scheduler
! (save-excursion (semantic-fetch-tags))
! nil)
! ;; If we are here, it is because the lexical step failed,
! ;; proably due to unterminated lists or something like that.
!
! ;; We do nothing, and just wait for the next idle timer
! ;; to go off. In the meantime, remember this, and make sure
! ;; no other idle services can get executed.
! (setq lexically-safe nil))
;; Let people hook into this, but don't let them hose
;; us over!
(condition-case nil
! (run-hooks 'semantic-after-idle-scheduler-reparse-hooks)
! (error (setq semantic-after-idle-scheduler-reparse-hooks nil))))
! ;; Return if we are lexically safe
! lexically-safe))
;;; IDLE SERVICES
--- 325,387 ----
Does nothing if the current buffer doesn't need reparsing."
! ;; These checks actually occur in `semantic-fetch-tags', but if we
! ;; do them here, then all the bovination hooks are not run, and
! ;; we save lots of time.
! (cond
! ;; If the buffer was previously marked unparseable,
! ;; then don't waste our time.
! ((semantic-parse-tree-unparseable-p)
! nil)
! ;; The parse tree is already ok.
! ((semantic-parse-tree-up-to-date-p)
! t)
! (t
! ;; If these cases are true, then don't do any additional work.
! (let* ((semantic-working-type nil)
! (inhibit-quit nil)
! (working-use-echo-area-p
! (not semantic-idle-scheduler-working-in-modeline-flag))
! (working-status-dynamic-type
! (if semantic-idle-scheduler-no-working-message
! nil
! working-status-dynamic-type))
! (working-status-percentage-type
! (if semantic-idle-scheduler-no-working-message
! nil
! working-status-percentage-type))
! (lexically-safe t)
! )
;; Let people hook into this, but don't let them hose
;; us over!
(condition-case nil
! (run-hooks 'semantic-before-idle-scheduler-reparse-hooks)
! (error (setq semantic-before-idle-scheduler-reparse-hooks nil)))
!
! (unwind-protect
! ;; Perform the parsing.
! (progn
! (when semantic-idle-scheduler-verbose-flag
! (working-temp-message "IDLE: reparse %s..." (buffer-name)))
! (when (semantic-lex-catch-errors idle-scheduler
! (save-excursion (semantic-fetch-tags))
! nil)
! ;; If we are here, it is because the lexical step failed,
! ;; proably due to unterminated lists or something like that.
!
! ;; We do nothing, and just wait for the next idle timer
! ;; to go off. In the meantime, remember this, and make sure
! ;; no other idle services can get executed.
! (setq lexically-safe nil))
! (when semantic-idle-scheduler-verbose-flag
! (working-temp-message "IDLE: reparse %s...done" (buffer-name))))
! ;; Let people hook into this, but don't let them hose
! ;; us over!
! (condition-case nil
! (run-hooks 'semantic-after-idle-scheduler-reparse-hooks)
! (error (setq semantic-after-idle-scheduler-reparse-hooks nil))))
! ;; Return if we are lexically safe
! lexically-safe))))
;;; IDLE SERVICES
|