DNU and Stack Reification Timing Tests

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

DNU and Stack Reification Timing Tests

Edward Stow
Hi List

Out of interest enclosed are some simple timing tests to determine the
relative amount of time taken for:
1: A direct message to a method  (direct)
2. An indirect message call via doesNotUnderstand: redirection (indirect)
3. Locating an object via by reification of the message stack. (reification)

The following code can be filed in  and then the expression performed

EsTimingTest timedTestsRepeated: 1000*1000

The results:

direct:  1.0  (this is the base measure)
indirect: 5.7 (that is 5.7 times longer than direct)
reification: 40.1 (that is 40.1 times longer than a direct message call

Interesting -- I always knew that recreating the stack was expensive.

These results may have little significance to AIDA depending on the
frequency of usage.

I have attached and enclosed the code to run the tests.
--
Edward

=======================

'From Squeak3.9.1 of 2 March 2008 [latest update: #7075] on 2 April
2008 at 3:40:25 pm'!
Object subclass: #EsTimingTest
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'TimingTest'!

!EsTimingTest methodsFor: 'as yet unclassified' stamp: 'ehs 4/2/2008 10:08'!
directCall
        "Do nothing"! !

!EsTimingTest methodsFor: 'as yet unclassified' stamp: 'ehs 4/2/2008 15:38'!
doesNotUnderstand: aMessage

        ^self
                perform: #directCall
                withArguments: aMessage arguments
! !

!EsTimingTest methodsFor: 'as yet unclassified' stamp: 'ehs 4/2/2008 15:39'!
stackReification
        "Typically the WebApplication object is about 3 or 4 levels deep.
Simulate this with the counter"
        |context counter |

        context := thisContext.
        counter := 0.
                [context notNil] whileTrue: [
                counter := counter + 1.
                ((context receiver isKindOf: WebApplication) | (counter > 3))
ifTrue: [^context receiver].
                context := context sender].
! !

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

EsTimingTest class
        instanceVariableNames: ''!

!EsTimingTest class methodsFor: 'as yet unclassified' stamp: 'ehs
4/2/2008 15:25'!
timedTest: aBlock repeat: anInteger
        ^Time millisecondsToRun: [ anInteger timesRepeat: aBlock]
                ! !

!EsTimingTest class methodsFor: 'as yet unclassified' stamp: 'ehs
4/2/2008 15:36'!
timedTestsRepeated: anInteger
        | test denominator |
        test := EsTimingTest new.
        ^(OrderedCollection new
                add: (denominator := self timedTest: [ test directCall ] repeat: anInteger) ;
                add: (self timedTest: [ test unknownMethod ] repeat: anInteger) ;
                add: (self timedTest: [ test stackReification ] repeat: anInteger) ;
                yourself) asArray collect: [:each | (each / denominator) roundTo: 0.1 ]! !

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

EsTimingTest.st (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: DNU and Stack Reification Timing Tests

Holger Kleinsorgen-4
> The results:
>
> direct:  1.0  (this is the base measure)
> indirect: 5.7 (that is 5.7 times longer than direct)
> reification: 40.1 (that is 40.1 times longer than a direct message call

VisualWorks 7.6, Win2K, Intel Q6600:

direct:  1.0
indirect:  13.4
reification:  46.8
active process:  40.4

The active process test:

EsTimingTest>>activeProcess
   ^ Processor activeProcess environmentAt: #WebApplication

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: DNU and Stack Reification Timing Tests

Nicolas Petton
In reply to this post by Edward Stow
Hi,

This is very ineresting, thank you. #firstAppFromStack and
#firstSessionFromStack are not called so frequently. But what if there
are simultaneously a lot of users connecting to a site at the same time?
Aida is already quite fast, but maybe with another pattern we could
increase its speed ?

Cheers!

Nico
--
Nicolas Petton
http://nico.bioskop.fr
            ___
          ooooooo
         OOOOOOOOO
        |Smalltalk|
         OOOOOOOOO
          ooooooo
           \   /
            [|]
--------------------------------
Ma clé PGP est disponible ici :
http://nico.bioskop.fr/pgp-key.html

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

signature.asc (196 bytes) Download Attachment