[Newbies] Can "Method source with it" be sped up?
bert at freudenbergs.de
Sun Jun 29 17:51:50 UTC 2008
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 find "Method source with it" a last, but often used method when
>>> where a string is used, when forgetting how something is
>>> implemented but
>>> remembering some key string etc - sort of a brute force "google on
>>> source", very useful.
>> For finding a String within source (like, looking up a menu
>> label), use "Method Strings with it", Alt-Shift-E. I have never
>> needed method source with it once I learned what that did.
> 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
> 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.
> In any case I cannot use it the way it works for me at this
> 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
> 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 -
More information about the Beginners