[REBOL] Re: Shamless request for improving function speed.
From: reboler:programmer at: 28-Mar-2002 12:17
Re: Improving function speed (no code)
Thanks Ryan, and Ladislav, for your help with improving function speed.
After removing one 'append from ARCFOUR,
and changing the code such that the series is modified in place I increased speed by
16-17%.
After replacing all the 'for in ARCFOUR with 'loop, I gained another 15% on top of that.
Overall function execution time was decreased by a solid 28% !
I used FX5's Profiler to do my time tests. Great Proggie!
Too bad I can't show you the improved code... ;^/
An interesting phenom: for iterations (k) over 1000, 'loop beats 'for always,
but under 1000 it's a toss-up which one is faster.
(I tried the following...
cp-orig: func [string][for n 1 k 1 [xor #"1" #"a"]]
cp-new: func [string][loop k [xor #"1" #"a"]]
)
It does not seem to be related to some 1k (1024) barrier.
PS: I've just read Joel's excellent analysis
and now I may have to try constructing a new series instead of mod-in-place!
I still can't get rid of one 'append though ...
...
s: j: i: 0
state: make block! 256
loop 256 [append state s s: s + 1]
...
--
_______________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup
Win the Ultimate Hawaiian Experience from Travelocity.
http://ad.doubleclick.net/clk;4018363;6991039;n?http://svc.travelocity.com/promos/winhawaii/