Den 05.02.2010 11:15, skrev Laval Jannik:
> Hi all,
>
> I have used SystemNavigation>>unsentMessagesInPackageNamed:
> on the package Morphic.
>
Wow, I feel your pain, the runtime of that method is quite brutal for
large packages...

Find attached a somewhat faster (but still slow) implementation.

Test:
findTime := [unsent := SystemNavigation default
unsentMessagesInPackageNamed: 'Morphic'] timeToRun

Numbers on my machine:
Current:
findTime - 29 minutes, 35 seconds.
unsent size - 531

Attached:
findTime - 3 minutes, 9 seconds.
unsent size - 531

Cheers,
Henry
'From PharoCore1.1ALPHA of ''19 October 2009'' [Latest update: #11194] on 5 
February 2010 at 1:50:49 pm'!

!TPureBehavior methodsFor: 'testing method dictionary' stamp: 
'HenrikSperreJohansen 2/5/2010 13:44'!
thoroughHasSelectorReferringTo: literal special: specialFlag byte: specialByte
        "Answer true if any of my methods access the argument as a 
        literal. Dives into the compact literal notation, making it slow but 
        thorough "

        
        self methodsDo: [ :method |
                ((method hasLiteralThorough: literal) or: [specialFlag and: 
[method scanFor: specialByte]])
                        ifTrue: [^true]].
        ^false! !


!SystemNavigation methodsFor: 'message sends' stamp: 'HenrikSperreJohansen 
2/5/2010 13:49'!
isUnsentMessage: selector
        | special byte |
        
        special := Smalltalk 
                hasSpecialSelector: selector
                ifTrueSetByte: [ :b | byte := b ].
        self allBehaviorsDo: 
                [ :behavior | 
                (behavior 
                        thoroughHasSelectorReferringTo: selector
                        special: special
                        byte: byte) ifTrue: [^false] ].
        ^true! !

_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to