logo       

Re: AutoCompMethodBrowser: msg#00234

audio.supercollider.devel

Subject: Re: AutoCompMethodBrowser

Benchmark and output:

bench({
m = IdentitySet.new;
Class.allClasses.do({ |class|
class.methods.do({ |method|
method.name.asString.containsi("value").if({
m.add(method);
});
});
});
m.size.postln;
});

178
time to run: 0.40426714099999 seconds.


It's 10x longer than your test. Not excruciating but I don't think it's quite satisfactory.

I will go ahead and make the changes now but I would love to see primitives for contains and containsi. (The reason for partial string matching is that you shouldn't have to type the whole method name to use an auto-completion feature :)

hjh

On Wednesday, Aug 25, 2004, at 17:52 US/Eastern, James Harkins wrote:

Actually, the speed issue is that I'm doing partial
string matching on method selectors. Let me benchmark
it tonight before making any code changes.

I would be in favor of primitives for String-contains
and String-containsi. That would probably eliminate
the speed concerns.

hjh

--- James Harkins <jamshark70-/E1597aS9LQAvxtiuMwx3w@xxxxxxxxxxxxxxxx> wrote:

OK, I'll change it tonight. I didn't know about the
impact on GC when I wrote it.

hjh

--- James McCartney <asynth-Xhj3G7Rj6JI@xxxxxxxxxxxxxxxx> wrote:

classvar methDict; // note, not the same as
Class-methods
// this is a dictionary: selector -> [method,
method, method...]
// with this, I can look up method selectors
almost instantly
// otherwise, every time I would have to
search
the whole class
tree (slow)

*initClass {
methDict = IdentityDictionary.new;
Class.allClasses.do({ |class|
class.methods.do({ |meth|
// if this selector hasn't been initialized,
make a new set
methDict[meth.name].isNil.if({
methDict.put(meth.name, Set.new); });
methDict[meth.name].add(meth);
});
});
methodExclusions = [];
}

This is really wasteful. It creates a huge
directory, most of which is
never used. It should be done as needed.
To do it each time it is needed is not so slow.
The
code below runs in
40 milliseconds on my machine.
Perhaps a primitive that returns the methods for a
selector would help
here if speed is really a problem.
Why is the Set not an IdentitySet?
All those objects make the GC take longer to
complete a cycle resulting
in more garbage generated before a collection.
Larger working sets also
make cache performance worse.

(
var methods, selector;
selector = \value;
bench {
methods = [];
Class.allClasses.do({ |class|
class.methods.do({ |meth|
if (meth.name == selector) {
methods = methods.add(meth);
}
});
});
};
methods.postln;
)
_______________________________________________
sc-dev mailing list
sc-dev-Ayv8T2snMLBt9CRQqspbbg@xxxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-dev



=====
____ James Harkins /// dewdrop world
\ / jamshark70-/E1597aS9LQAvxtiuMwx3w@xxxxxxxxxxxxxxxx
\/ http://www.dewdrop-world.net

"... love and hot pants, peace, harmony..."
-- Dick Lee, Hot Pants: The Musical
_______________________________________________
sc-dev mailing list
sc-dev-Ayv8T2snMLBt9CRQqspbbg@xxxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-dev



=====
____ James Harkins /// dewdrop world
\ / jamshark70-/E1597aS9LQAvxtiuMwx3w@xxxxxxxxxxxxxxxx
\/ http://www.dewdrop-world.net

"... love and hot pants, peace, harmony..."
-- Dick Lee, Hot Pants: The Musical
_______________________________________________
sc-dev mailing list
sc-dev-Ayv8T2snMLBt9CRQqspbbg@xxxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-dev


____________________________________

H. James Harkins /// dewdrop_world
http://www.dewdrop-world.net

"If attacked by a lion, thrust your arm down his throat.
This takes some practice." -- Cyril Connolly

_______________________________________________
sc-dev mailing list
sc-dev-Ayv8T2snMLBt9CRQqspbbg@xxxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-dev
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise