Indeed. Thanks!

> This is more than twice as fast, though it may be still too slow for  
> your
> needs:
>
>       | depth running |
>       running := thisContext.
>       depth := 1.
>       [ (running := running instVarAt: 1) == nil ]
>               whileFalse: [ depth := depth + 1 ].
>       depth


[       100000 timesRepeat: [ | depth running |
        running := thisContext.
        depth := 1.
        [ (running := running instVarAt: 1) == nil ]
                whileFalse: [ depth := depth + 1 ].
        depth ]
] timeToRun
=> 321

[       100000 timesRepeat: [| depth running |
depth := 0.
running := thisContext.
[ running sender notNil ] whileTrue: [ running := running sender.
depth := depth + 1].
depth]
] timeToRun
=> 942
-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to