iterating on compiled methods

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

iterating on compiled methods

Nicolas Cellier
I noticed the first pattern is often used: we iterate on selectors
when we want to iterate on CompiledMethods
methodDictionary do: is maybe not a nice pattern, wa can replace with
compiledMethodsDo: or just methodsDo:
I think such change could be noticeable in development tools on slow machines

{
[Morph selectorsDo: [:sel | | m | m := Morph compiledMethodAt: sel]] bench.
[Morph methodDictionary do: [:m | ]] bench.
}
#('683.0633873225355 per second.' '4275.94481103779 per second.')

Nicolas

Reply | Threaded
Open this post in threaded view
|

Re: iterating on compiled methods

Eliot Miranda-2


On Fri, Jan 15, 2010 at 1:08 PM, Nicolas Cellier <[hidden email]> wrote:
I noticed the first pattern is often used: we iterate on selectors
when we want to iterate on CompiledMethods
methodDictionary do: is maybe not a nice pattern, wa can replace with
compiledMethodsDo: or just methodsDo:
I think such change could be noticeable in development tools on slow machines


I think the right way to iterate over a class's methods is

aClass selectorsAndMethodsDo: [:sel :meth| ... ]
 
{
[Morph selectorsDo: [:sel | | m | m := Morph compiledMethodAt: sel]] bench.
[Morph methodDictionary do: [:m | ]] bench.
}
#('683.0633873225355 per second.' '4275.94481103779 per second.')

Nicolas




Reply | Threaded
Open this post in threaded view
|

Re: iterating on compiled methods

Nicolas Cellier
2010/1/16 Eliot Miranda <[hidden email]>:

>
>
> On Fri, Jan 15, 2010 at 1:08 PM, Nicolas Cellier
> <[hidden email]> wrote:
>>
>> I noticed the first pattern is often used: we iterate on selectors
>> when we want to iterate on CompiledMethods
>> methodDictionary do: is maybe not a nice pattern, wa can replace with
>> compiledMethodsDo: or just methodsDo:
>> I think such change could be noticeable in development tools on slow
>> machines
>>
>
> I think the right way to iterate over a class's methods is
> aClass selectorsAndMethodsDo: [:sel :meth| ... ]
>

Good, that's just what I did.

>>
>> {
>> [Morph selectorsDo: [:sel | | m | m := Morph compiledMethodAt: sel]]
>> bench.
>> [Morph methodDictionary do: [:m | ]] bench.
>> }
>> #('683.0633873225355 per second.' '4275.94481103779 per second.')
>>
>> Nicolas
>>
>
>
>
>
>