Counting Messages as a Proxy for Average Execution Time in Pharo

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

Counting Messages as a Proxy for Average Execution Time in Pharo

abergel
Hi!

There has been many discussion on profiling and execution. I believe the paper titled "Counting Messages as a Proxy for Average Execution Time in Pharo" draws some bases for a new generation of code profilers that are not tied to execution sampling. Advantages are numerous without not that many drawbacks.

http://bergel.eu/download/papers/Berg11c-compteur.pdf

I will put some effort on having "Compteur" in the main Pharo vm. This has to be carefully done and monitored to make sure there is no unwanted overhead. In the experience I have done, there is no overhead. I have started to get in touch with people close to the VM. I will keep you informed, especially when reviews and testing will be needed.

One very cool think that everybody can benefit from, is to be able to write assertion in unit tests like:
        self assertIs: [ "expression1" ] fasterThan: [ "expression2" ]

It compares the amount of messages sent by expression1 with the amount of messages sent by expression2, no matter how many messages are sent. Counting messages is, in the average, closely link to the average execution time.
This cannot be done with [ ... ] timeToRun or MessageTally.

I will keep you informed.

Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.





Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-project] Counting Messages as a Proxy for Average Execution Time in Pharo

Michael Haupt-3
Alex,

On 28 April 2011 15:37, Alexandre Bergel <[hidden email]> wrote:
> Counting messages is, in the average, closely link to the average execution time.

I believe this is correct only as long as a purely interpreting VM is
used, even though quick messages add a tiny bit of uncertainty. But
add a JIT compiler and some inlining, and timeToRun and MessageTally
are suddenly interesting again.

Not having read your text, I surely cannot say anything remotely
conclusive, but the assumption that execution time roughly equals the
amount of messages sent seems rather naïve once you leave the cosy
well-predictable niche inhabited by pure interpreters.

Best,

Michael
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-project] Counting Messages as a Proxy for Average Execution Time in Pharo

abergel
Hi Michael,

There is a long discussion in the paper about exactly what you are mentioning here.
The assumptions are made for the current version of Pharo: with its naive VM, not state-of-the-Art JIT, naive compiler, simple GC and so on.

I agree with you that the result I found may not be valid in Java or .Net. However they are for the current Pharo. And apparently, this is not likely to change anything soon.

Alexandre


On 28 Apr 2011, at 08:57, Michael Haupt wrote:

> Alex,
>
> On 28 April 2011 15:37, Alexandre Bergel <[hidden email]> wrote:
>> Counting messages is, in the average, closely link to the average execution time.
>
> I believe this is correct only as long as a purely interpreting VM is
> used, even though quick messages add a tiny bit of uncertainty. But
> add a JIT compiler and some inlining, and timeToRun and MessageTally
> are suddenly interesting again.
>
> Not having read your text, I surely cannot say anything remotely
> conclusive, but the assumption that execution time roughly equals the
> amount of messages sent seems rather naïve once you leave the cosy
> well-predictable niche inhabited by pure interpreters.
>
> Best,
>
> Michael
>

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.





Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-project] Counting Messages as a Proxy for Average Execution Time in Pharo

Michael Haupt-3
Hi Alex,

On 28 April 2011 16:03, Alexandre Bergel <[hidden email]> wrote:
> There is a long discussion in the paper about exactly what you are mentioning here.

wonderful, I'm going to go read it then. :-)

> I agree with you that the result I found may not be valid in Java or .Net. However they are for the current Pharo. And apparently, this is not likely to change anything soon.

Not even with increasing support from Cog?

Best,

Michael
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-project] [smalltalk-research] Re: Counting Messages as a Proxy for Average Execution Time in Pharo

abergel
>> I agree with you that the result I found may not be valid in Java or .Net. However they are for the current Pharo. And apparently, this is not likely to change anything soon.
>
> Not even with increasing support from Cog?


No idea. Together with Eliot we implemented Compteur in Cog. I made some experiments and the results are apparently similar than in a non-jitted VM.

If Cog continue to improve, then the assumptions may not be valid anymore.

Alexandre

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.





Reply | Threaded
Open this post in threaded view
|

Re: Counting Messages as a Proxy for Average Execution Time in Pharo

stephane ducasse-2
In reply to this post by abergel
cool an ecoop paper with pharo in the title :)

Stef

On Apr 28, 2011, at 3:37 PM, Alexandre Bergel wrote:

> Hi!
>
> There has been many discussion on profiling and execution. I believe the paper titled "Counting Messages as a Proxy for Average Execution Time in Pharo" draws some bases for a new generation of code profilers that are not tied to execution sampling. Advantages are numerous without not that many drawbacks.
>
> http://bergel.eu/download/papers/Berg11c-compteur.pdf
>
> I will put some effort on having "Compteur" in the main Pharo vm. This has to be carefully done and monitored to make sure there is no unwanted overhead. In the experience I have done, there is no overhead. I have started to get in touch with people close to the VM. I will keep you informed, especially when reviews and testing will be needed.
>
> One very cool think that everybody can benefit from, is to be able to write assertion in unit tests like:
> self assertIs: [ "expression1" ] fasterThan: [ "expression2" ]
>
> It compares the amount of messages sent by expression1 with the amount of messages sent by expression2, no matter how many messages are sent. Counting messages is, in the average, closely link to the average execution time.
> This cannot be done with [ ... ] timeToRun or MessageTally.
>
> I will keep you informed.
>
> Cheers,
> Alexandre
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>