[squeak-dev] Profiling

Colin Putney colin at wiresong.com
Sun Jan 13 18:23:57 UTC 2013


On Thu, Jan 10, 2013 at 2:08 PM, Eliot Miranda <eliot.miranda at gmail.com>wrote:


> However, if all the associationsDo: block does is invoke a primitive then
> the Squeak profiler will not produce useful info.  The default profiler
> doesn't profile primitives correctly.  As others in this thread have
> pointed out there;s a better profiler written by Andreas Raab, which does
> profile primitives properly.
>

That's the issue, alright.

Here's the code:

adds keysAndValuesDo:
[:key :vector |
repository add: key vector: vector.
vector becomeForward: nil copyHash: false].

I had assumed that #add:vector: was the culprit, because it does
serialization, which involves walking the object graph rooted in the vector
and lots of double-dispatch. I found the FFI call and commented it out, and
running under the interpreter I was able to see all the serialization in
the profile. It was still a tiny proportion of the total time, but without
Cog to speed it up, it was at least showing up on the profile! That made me
realize how much time was being spent in primitives.

The fix is easy—just batch up the the objects to become, then do them all
at once with #elementsForwardIdentityTo:copyHash:.

Thanks all, for the help, and apologies for being slow to respond. I've
been without internet for the last few days.

Colin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20130113/1ac8ec06/attachment.html


More information about the Squeak-dev mailing list