diff --git a/benchmark/benchmark.gbs b/benchmark/benchmark.gbs index 7d1a70e1d..83623f6fb 100644 --- a/benchmark/benchmark.gbs +++ b/benchmark/benchmark.gbs @@ -20,15 +20,37 @@ Private Sub RunScript(sScript As String, sRun As String) As Float End +Private Sub FormatResult(cResult As Collection, sLang As String) As String + + Dim bBetter As Boolean = True + Dim sFormat As String + Dim sTest As String + + For Each sTest In ["python","perl","gambas"] + If cResult[sTest] < cResult[sLang] Then + bBetter = False + Break + Endif + Next + + sFormat = Format(cResult[sLang], "0.00") + If bBetter Then sFormat = "" & sFormat & "" + Return sFormat + +End + Dim sBenchmark As String Dim cResult As Collection Dim aResult As New Collection[] Dim sLang As String +Dim sResult As String +Dim iPos As Integer For Each sBenchmark In Dir(Application.Dir, "*.gbs") sBenchmark = File.BaseName(sBenchmark) If sBenchmark = "benchmark" Then Continue + If Args[1] And If sBenchmark <> Args[1] Then Continue cResult = New Collection aResult.Add(cResult) @@ -41,6 +63,24 @@ For Each sBenchmark In Dir(Application.Dir, "*.gbs") Next +' Print "
Benchmark | " For Each sLang In ["Python","Perl","Gambas","Gambas + JIT"] @@ -49,10 +89,10 @@ Next Print "||||||||
---|---|---|---|---|---|---|---|---|
[./";cResult!name; "] | " - Print ""; Format(cResult!python, "0.00");" | " - Print ""; Format(cResult!perl, "0.00");" | " - Print ""; Format(cResult!gambas, "0.00");" | " + Print "";cResult!name; " | " + Print ""; FormatResult(cResult, "python");" | " + Print ""; FormatResult(cResult, "perl");" | " + Print ""; FormatResult(cResult, "gambas");" | " Print ""; Format(cResult!gambasjit, "0.00");" | " Print "