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,16 +199,33 @@ EmacsInterface {
name -> devpath
})
.put( \helpSymbols, {
var result = IdentitySet.newFrom(SCDoc.docMap.keys);
Class.allClasses.do { | class |
if (class.isMetaClass.not) {
result.add(class.name.asString);
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.methods.do { | method |
result.add(method.name.asString);
Class.allClasses.do { | class |
if (class.isMetaClass.not) {
result.add(class.name.asString);
};
class.methods.do { | method |
result.add(method.name.asString);
};
};
};
result.asArray
result = result.asArray
}.bench(false);
"Emacs: Index help topics in % seconds\n".postf(dt.asStringPrec(3));
result
});
}
}