Comments on: Simpler time difference function
In A77 you can divide by time. I'm not sure why we didn't allow this earlier, but it's handy. Here's an example of why.
This is a handy piece of code for roughly measuring the time difference between two expressions:
diff-time: funct [reps [integer!] b1 [block!] b2 [block!]][
t1: dt [loop reps b1]
if zero? t1 [print "Use more repetitions." exit]
t2: dt [loop reps b2]
print [round/to t2 - t1 / t1 0.01% "slower"]
diff-time 1000000 [add 1.0 2.0] [add $1.0 $2.0]
This code benefits from time division as well as the round to percent bug fix.
Now, I can use it for timing the speed of extension commands (natives):
secure [extension allow]
t: import %ext-test.dll
diff-time 1000000 [negate 1] [t-neg 1]
diff-time 1000000 [add 1 2] [t-addi 1 2]
diff-time 1000000 [add 1.0 2.0] [t-addd 1.0 2.0]
Ah ha! You have proof that extension commands are as fast (in fact a bit faster for some operations) than natives. Interesting, no? (The reason this happens is because the built-in actions like add must by polymorphic over so many datatypes, so extra conditional branching and dispatching occurs.)
Of course, keep in mind that results from this simple technique of measurement will vary due to multitasking activities of your system. Run your test a few times.
Good Day friends, I am a novice to programing and just stumble on rebol and for past two days now, it has been wonderful experience,i dont know it could be this simple. p/s where can i download free rebol for biginners to get my hands on it, the links availabe to me are not working (http://rebol.com/view-platforms.html) Please help!!!
Chidi: I just checked the links at that URL, and they seem ok. What link did you find broken?|
Carl thank you so much for your reply, this is the link "http://rebol.com/view-platforms.html" it is not opening with my browser, i have used Mozila firefox and Internet Explorer browser still it is not opening. Please if there is any other way I can download the free beginers version,I will appreciate it. |
Chidi: the link also works for me. You may be behind a firewall that is blocking you from accessing that URL.
The direct URL for downloading the most recent Windows View version of REBOL is:
Maybe that will work for you.
Post a Comment:
You can post a comment here. Keep it on-topic.