[REBOL] Re: New competition: do you accept the challenge?! :-)
From: dhsunanda:gma:il at: 6-Nov-2007 15:32
Two very quick changes just to get into the spirit of the competition:
1. pre-allocate all space needed to the strings
2. use insert tail rather than append (append is not native in R2)
Runs in about 65% of the time of the original. Still not as close
as Java, but it was only a minute's work.
Someone is sure to do much better.
I suspect both Java and REBOL depend on the string handling
libraries of the compiler they are compiled under. That may mean
the relative timings will vary according to platform and release.
Sunanda
Changed code.....
print "START..."
s1: now
str: make string! 5000
finale: make string! 50000
repeat i 10000 [
clear str
repeat j 500 [
insert tail str reduce [i "," j "-"]
]
insert tail finale copy/part skip str 1 4
]
print "STOP!"
print length? finale
print (now/time - s1/time)