|
Re: AutoCompMethodBrowser: msg#00233audio.supercollider.devel
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 |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: n_map "freq" -1: 00233, Julian Rohrhuber |
|---|---|
| Next by Date: | Re: AutoCompMethodBrowser: 00233, James Harkins |
| Previous by Thread: | Re: AutoCompMethodBrowseri: 00233, James Harkins |
| Next by Thread: | Re: AutoCompMethodBrowser: 00233, James Harkins |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |