Hi,
The plain load is probably pretty quick. The ede, srecode, and code
helpers all call some 'global-*-mode'. To get at that code, it has to
load semantic.el, srecode.el, ede.el (or wherever that mode is defined)
plus all the minor mode infrastructure (ie - semantic-add-minor-mode).
Once the code runs, it just adds a hook.
It does seem like, from a performance point of view, all the
global-*-mode functions could be put in one place that only had those
modes in it. Then the hooks would be installed, and the code not loaded
till you loaded in a code file.
You could probably wrap your code like this:
(defun my-cedet-init ()
(global-this-mode 1)
(global-that-mode 1)
(remove-hook 'c-mode-hook 'my-cedet-init)
(remove-hook 'c++-mode-hook 'my-cedet-init)
(remove-hook 'java-mode-hook 'my-cedet-init)
;; more of the same
)
(add-hook 'c-mode-hook 'my-cedet-init)
(add-hook 'c++-mode-hook 'my-cedet-init)
(add-hook 'java-mode-hook 'my-cedet-init)
That way all the good stuff is turned on the first time, but you remove
the hook when you are done.
Not sure how it would work. Give it a try and see.
Eric
On 05/02/2010 09:24 AM, Gary wrote:
> Hmm... I thought I'd sent this, but...
>
> On Fri, Apr 30, 2010 at 02:49:45PM -0400, Eric M. Ludlam wrote:
>> On 04/30/2010 01:35 PM, Gary wrote:
>>> Maybe this is obvious to old^H^H^Hexperienced heads, but is it possible
>>> to delay loading cedet components until they are really needed?
>
>> When you (load "cedet.el") it loads autoload files only. If you then
>> enable this-mode or that-mode, that is when it begins pulling in more files.
>>
>> Thus, if you:
>>
>> (load "cedet.el")
>>
>> and then do nothing else, very little will get pulled in from CEDET
>> until you call one of the `global-*-mode' functions.
>
> My cedet config looks like the example on the website -
>
> (require 'cl)
> (defvar *emacs-load-start* (current-time))
>
> (add-to-list 'load-path (expand-file-name "~/.emacs.d/cedet/common"))
> (load "cedet")
> (global-ede-mode t)
> (semantic-load-enable-code-helpers)
> (global-srecode-minor-mode 1)
>
> (add-to-list 'load-path (expand-file-name "~/.emacs.d/cedet/semantic"))
>
> (defun my-cedet-hook ()
> (local-set-key [(control return)] 'semantic-ia-complete-symbol)
> (local-set-key "\C-cj" 'semantic-complete-jump-local)
> (local-set-key "\C-cJ" 'semantic-complete-jump)
> (local-set-key "\C-c?" 'semantic-ia-complete-symbol-menu)
> (local-set-key "\C-c>" 'semantic-complete-analyze-inline)
> (local-set-key "\C-cp" 'semantic-analyze-proto-impl-toggle)
> )
>
> (message "cedet loaded in %ds" (destructuring-bind (hi lo ms) (current-time)
> (- (+ hi lo) (+ (first *emacs-load-start*) (second *emacs-load-start*)))))
>
> Which results in -
> Loading cedet...
> Setting up CEDET packages...done
> Loading cedet...done
> cedet loaded in 4s
>
> I don't know. Four seconds seems rather a long time to me (and I've seen
> timings of up to 9 seconds), especially when I know I'm not going to use
> it. You think it's the global-ede-mode, semantic-load-enable-code-helpers
> and global-srecode-minor-mode, then? Worth calling them only when, say,
> one or other programming modes gets activated? Is it okay to call them
> multiple times (for example once when c mode starts, another time when
> php mode starts, etc.)?
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Cedet-devel mailing list
> Cedet-devel@...
> https://lists.sourceforge.net/lists/listinfo/cedet-devel
>
|