OOo yes..well... I probably misinterpreted some functions :-)
But my goal was to check loops for speed... 
There are 2 surpricingly strange outcomes below...
have a look...your input!/output! is welcome..

*********************************************************************


Timers on simple functions
no complex element structures.
Output to sdtout

Tested on a 486 66 Mhz 32 Mb 
running core: 2.5.0.9.1



n: 100000





doloop: func [ n [integer!] ] [

        start: now/time/precise
        loop n [ prin "." ]
        end: now/time/precise
        print [ total: end - start ]
]

* Time loop: 0:01:33.52935



doforeach: func [ n [ integer!] ] [

        dots: array/initial n "."
        start: now/time/precise
        foreach dot dots [ prin dots ]
        end: now/time/precise
        print [ total: end - start ]
]

* Time foreach: over 60 minutes !!!!!!!!! 
(wont even finish untill now :)
(Also: The above func eats OS resources like a milky bar!!!..dammmmm...)




doforall: func [ n [integer!] ] [
        
        dots: array/initial n "."
        start: now/time/precise
        forall dots [ prin first dots ]
        end: now/time/precise
        print [ total: end - start ]
]

* Time forall: 0:04:43.023292



doforskip: func [ n [integer!] ] [
        
        dots: array/initial n "."
        start: now/time/precise
        forskip dots 1 [ prin first dots ]
        end: now/time/precise
        print [ total: end - start ]
]

* Time forskip: 0:04:13.541465



dowhile: func [ n [integer!] ] [
        
        x: 0
        start: now/time/precise
        while [ x <= n ] [ [ prin "." ] x: x + 1 ]
        end: now/time/precise
        print [ total: end - start ]
]

* Time while: 0:00:04.03787



dosort1: func [ n [integer!] ] [

        dots: array/initial n "."
        start: now/time/precise
        sort [ prin first dots ]
        end: now/time/precise
        print [ total: end - start ]
]

* Time sort1: 0:00:01.417908




dosort2: func [ n [integer!] ] [

        dots: array/initial n (to-char random(256))
        start: now/time/precise
        sort [ prin first dots ]
        end: now/time/precise
        print [ total: end - start ]
]

* Time sort2: 0:00:00.978082
(Why is this quicker then sort1 ????, dont be fooled by random!!!)



dorepeat:  func [ n [integer!] ] [

        start: now/time/precise
        repeat cnt n [ prin "." ]
        end: now/time/precise
        print [ total: end - start ]
]

* Time repeat: 0:01:44.671599





And finaly..

print now/time/precise array/initial 100000 "." print now/time/precise

* Time Array/initial: 0:00:00.317948



(R),
Norman.


-- dinner/conversation: "How do you eat your Rebol in the morning?"
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to