scel: speedup indexing of help topics

instead of asking SCDoc to index all help topics, we guess the topics
by matching schelp paths

Signed-off-by: Tim Blechmann <tim@klingt.org>
This commit is contained in:
Tim Blechmann 2011-10-02 12:15:04 +02:00
parent fef0729223
commit 1f339518ab

View file

@ -199,7 +199,20 @@ EmacsInterface {
name -> devpath
})
.put( \helpSymbols, {
var result = IdentitySet.newFrom(SCDoc.docMap.keys);
var result, dt;
dt = {
result = IdentitySet.new(16384);
SCDoc.helpSourceDirs.do {|dir|
var list = ("%/*/*.schelp").format(dir).pathMatch;
list = list ++ ("%/*/*/*.schelp").format(dir).pathMatch;
list = list ++ ("%/*/*/*/*.schelp").format(dir).pathMatch;
list = list.collect {|path| path.asRelativePath(dir).removeExtension};
list.do {|topic|
result.add(topic)
}
};
Class.allClasses.do { | class |
if (class.isMetaClass.not) {
result.add(class.name.asString);
@ -208,7 +221,11 @@ EmacsInterface {
result.add(method.name.asString);
};
};
result.asArray
result = result.asArray
}.bench(false);
"Emacs: Index help topics in % seconds\n".postf(dt.asStringPrec(3));
result
});
}
}