discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C and Smalltalk; speed of message send


From: Richard Frith-Macdonald
Subject: Re: Objective-C and Smalltalk; speed of message send
Date: Tue, 10 Aug 2004 10:04:31 +0100


On 10 Aug 2004, at 09:32, Marcel Weiher wrote:


On 8 Aug 2004, at 05:08, Lyndon Tremblay wrote:

"5 timesRepeat: [ Transcript show: 0 tinyBenchmarks; cr ]"

Both compiled at -O3,
C Function - 1938968 calls/sec
Objective-C Message - 824973 sends/sec

This is under a system with stable load, tested multiple times. I've had the Squeak test at "144m bytecodes/sec; 7.7m sends/sec", so perhaps an active image had an effect here. Um, tell me what I have missed, or what is really
going on. I am surprised enough to not believe it is a fair test.

Apart from what Richard said, it seems you are primarily measuring the speed of the getrusage() system call that clock() tends to be based on...

Actually no ... if you examine the code carefully, you will see that clock() is used to time operations (one call to clock() before the operation and one call after), but that the only operation actually used for presenting a result is the fist one which takes over a second to execute ... so the execution time of clock() is insignificant.

Actual message passing speed for a constant receiver is around 50 ns on 1 Ghz G4, with a third of that going to inter-module calling overhead. So around 20 million message sends per second. Squeak on the same system is significantly slower.

That's interesting.
Is that with the apple or gnu runtime?
Is that repeated uses of the same message to objects of the same class? I ask because the apple runtime caches those and is much faster if you benchmark that than if you benchmark against a large variety of different methods. Of course, you can argue that performance is most important in a tight loop sending one message repeatedly ...





reply via email to

[Prev in Thread] Current Thread [Next in Thread]