Change parser to do C style () for operators: 1+2*3 == 1+(2)*3
[io/jrb1.git] / addons / Box / tests / performance / runSpeedTests.io
blob6664a808cf13cf7a9b916e662d89bfa089795bb8
2 writeln("running Io tests...")
3 System system("./ioServer Math/_tests/speed.io > Math/_tests/SpeedResults.txt")
5 writeln("running Python tests...")
6 System system("python Math/_tests/speed.py >> Math/_tests/SpeedResults.txt")
8 Namespace := Object clone(
9 forward := method(
10 if (thisMessage arguments size == 0, self setSlot(thisMessage name, self clone))
14 Languages := Object clone
15 Languages doFile("Math/_tests/SpeedResults.txt")
17 Object foreach := method(
18 self slotNames sort foreach(slotName,
19 sender setSlot(thisMessage argAt(0) name, slotName)
20 sender setSlot(thisMessage argAt(1) name, self getSlot(slotName))
21 sender doMessage(thisMessage argAt(2))
25 writeln("""
26 <html> <head> <title>io - about - speed - ppc</title> <link rel="stylesheet" href="http://www.iolanguage.com/site.css"> <META HTTP-EQUIV="EXPIRES" CONTENT=0> </head> <body>
27 """)
30 maxResultFor := method(testName,
31 max := 0
32 Languages foreach(langName, lang,
33 m := lang getSlot(testName) asNumber
34 if (m > max, max = m)
36 max
39 writeln("<br><br><ul>")
40 numberOfLanguages := Languages slotNames size
41 Languages Io foreach(testName, testResult,
42 if (testName == "version", continue)
43 writeln(testName, "<p>")
44 //writeln("<ul>")
45 tname := testName replace("minus", "-") replace("plus", "+") replace("times", "*")
46 tname := tname replace("Equals", "=")
48 writeln("<table cellpadding=0 cellspacing=1 border=0>")
49 //writeln("<tr>")
50 //writeln("<table cellpadding=0 cellspacing=1 border=0>")
52 maxResult := maxResultFor(testName)
54 Languages foreach(langName, lang,
55 if (langName == "Io") then(
56 color := "#ccccff"
57 bgcolor := "#9999cc"
58 bgcolor2 := "#8888bb"
60 color := "#aaaacc"
61 bgcolor := "#9999cc"
62 bgcolor2 := "#8888bb"
64 color := "#999999"
65 bgcolor := "#9999cc"
66 bgcolor2 := "white"
67 ) else (
68 color := "#bbbbbb"
69 bgcolor := "#888888"
70 bgcolor2 := "#999999"
72 color := "#999999"
73 bgcolor := "#888888"
74 bgcolor2 := "#777777"
76 bgcolor2 := "white"
80 writeln("<tr>")
81 writeln("<td>")
83 r := lang getSlot(testName) asNumber
84 //w := ((r/maxResult) * 400)
85 w := r * 120
87 writeln("<table cellpadding=3 cellspacing=0 border=0>")
88 writeln("<tr><td width=50 align=right bgcolor=", bgcolor2, "><font color=", color , ">", langName asLowercase, "&nbsp;</td>")
89 if (w > 1,
90 writeln("<td bgcolor=", bgcolor, " width=", w, "></td>")
92 writeln("<td><font color=#eeeeee>", r, "</td>")
93 writeln("</tr>")
94 writeln("</table>")
95 writeln("</td></tr>")
97 writeln("</td></tr></table>")
98 //writeln("</ul><br>")
99 writeln("<br><br>")
100 //writeln("<br>")
104 writeln("versions<p>")
105 writeln("<ul>")
106 Languages foreach(langName, lang,
107 writeln(langName, " ", lang version, "<br>")
109 writeln("</ul>")
111 writeln("</ul>")