Can "Method source with it" be sped up?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Can "Method source with it" be sped up?

Milan Zimmermann-2
Hi,

I find "Method source with it" a last, but often used method when looking
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.

It is, however exteremely slow. "grep" a file of a size of the image source
takes virtually no time, unlike "Method source with it".

I  wonder if anyone looked at a way to  speed up  "Method source with it", or
is it a hard thing to do? (Also restricting the searched source to a category
would help)

Thanks Milan
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Can "Method source with it" be sped up?

Tapple Gao
On Mon, Jun 23, 2008 at 12:01:52AM +0000, Milan Zimmermann wrote:
> Hi,
>
> I find "Method source with it" a last, but often used method when looking
> 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.

--
Matthew Fulmer -- http://mtfulmer.wordpress.com/
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Can "Method source with it" be sped up?

Milan Zimmermann-2
On 2008 June 23, Matthew Fulmer wrote:

> On Mon, Jun 23, 2008 at 12:01:52AM +0000, Milan Zimmermann wrote:
> > Hi,
> >
> > I find "Method source with it" a last, but often used method when looking
> > 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 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? 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.

Milan
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Can "Method source with it" be sped up?

Bert Freudenberg

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:
>>> Hi,
>>>
>>> I find "Method source with it" a last, but often used method when  
>>> looking
>>> 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  
> 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.

> 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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Can "Method source with it" be sped up?

Milan Zimmermann-2
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:
<<snio>>

> >
> > 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
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners