[Newbies] Can "Method source with it" be sped up?
milan.zimmermann at sympatico.ca
Mon Jun 30 01:18:06 UTC 2008
On 2008 June 29, Bert Freudenberg wrote:
> Am 29.06.2008 um 15:28 schrieb Milan Zimmermann:
> > On 2008 June 23, Matthew Fulmer wrote:
> >> On Mon, Jun 23, 2008 at 12:01:52AM +0000, Milan Zimmermann wrote:
> > I do not trust "method strings with it". Maybe I am missing
> > something, but try
> > this: Highlight an instance variable in class definition. Do "method
> > strings
> > with it" - it finds nothing, even though that variable is in many
> > places in
> > that class methods. BTW, am I missing something here, is this a
> > bug, or is
> > this expected?
> Expected. It only looks in literal strings (written as 'string') -
> that is, labels etc.
ah, thanks. Regarding why is it slow, I looked at the implementation after
reading your description below, and do see the complexity. I am grumpy about
searching source any time I do things outside eToys (which I hopefully will
have opportunity do quite a bit now), so I try to borrow some ideas from
CompiledMethod>>#getSourceFor:in: and create "search everything" which would
search sources and changes for any string and display the found line(s)... or
something like that
Thanks for clarification and pointers, Milan
> > In any case I cannot use it the way it works for me at this
> > point.
> > Also, I often I find a situation that I remember a string or token
> > that I know
> > relates to the "thing" I am looking for. What I remember is often
> > part of
> > instvar name, perhaps part of method name, comment, or whatever.
> > For those
> > situations (and I seem not be alone in that mental flaw :) ) it is
> > great to
> > just say "search everything" -like googgle. But it is prohibitively
> > slow in
> > Squeak (and no caching happens such as it seems to in for example
> > Eclipse
> > where first search is quite fast and following very fast).
> > Anyway, apart from wishing it would be faster I was curious if
> > anyone has an
> > idea why.
> Yes. It uses the regular "get method source" approach for each method
> in each class. That is, for each method in the system, it opens the
> sources file, seeks to the method offset, reads sequentially until it
> finds a chunk marker ('!' but not '!!'), closes file, replaces all
> '!!' with '!', answers text. Possibly it also styles the method if it
> was saved with embedded links etc. Possibly it even scans backwards to
> find the method time stamp (though I'd hope when just getting the
> source text we would not hit this).
> Anyway, this is way more inefficient that just seeking for a string in
> a file sequentially.
> - Bert -
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
More information about the Beginners