[REBOL] New competition: do you accept the challenge?! :-)
From: ale870::gmail::com at: 6-Nov-2007 22:51
Hi,
today I was checking Rebol performance vs Java.
So, my first test was some calculation tests. Performance were comparable!
(I like it!!!).
Then I made some strings peformance tests. In this case I got bad results.
Infact, it seems Java is REALLY FASTER than Rebol :-(
So, my competion proposal is the following: creating a Rebol application
faster than the corresponding java one.
This is the java program (very easy):
====================================================================
public class Prova1 {
public Prova1() {
System.out.println("START...");
StringBuffer finale = new StringBuffer();
for(int i=1; i<10001; i++) {
StringBuffer str = new StringBuffer();
for(int j=1; j<501; j++) {
str.append(String.valueOf(i)).append(",").append(
String.valueOf(j)).append("-");
}
finale.append(str.substring(1, 5));
}
System.out.println("COMPLETED!!!");
System.out.println(finale.toString());
System.out.println(finale.length());
}
public static void main(String[] args) {
new Prova1();
}
}
====================================================================
rebol []
print "START..."
s1: now
str: make string! 1000
finale: make string! 10000
repeat i 10000 [
clear str
repeat j 500 [
append str reduce [i "," j "-"]
]
append finale copy/part skip str 1 4
]
print "STOP!"
print length? finale
print (now/time - s1/time)
halt
====================================================================
Can you optimize it in order to make it faster?
Just for curiosity. I have a notebook HP nc6320, Dual Core with 2Gb ram.
Performance results are:
Java application: 5 seconds.
Rebol application: 16 seconds
And now... the competion begins!!!!
As I made in the previous competion, I will publish the results in my site
(it will be a good tutorial for the beginners!!!)
Site (for Rebol desktop) is: http://sguish.50webs.org/index.r
(I'm sorry, some items are in Italian language, since I maintain the site
and a blog for italian people).
Thank you!
--
//Alessandro
http://sguish.wordpress.com
http://laccio.wordpress.com