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 "
" +' +' Exec ["uname", "-srv"] To sResult +' Print "Kernel: ";Html(sResult);"
" +' +' Exec ["cat", "/proc/cpuinfo"] To sResult +' For Each sResult In Split(sResult, "\n") +' If sResult Begins "model name" Then +' iPos = Instr(sResult, ":") +' If iPos Then +' Print "CPU: ";Html(Mid$(sResult, iPos+1));"
" +' Endif +' Break +' Endif +' Next +' +' Print "
" + Print "" Print "\n" For Each sLang In ["Python","Perl","Gambas","Gambas + JIT"] @@ -49,10 +89,10 @@ Next Print "" For Each cResult In aResult Print "" - Print "" - Print "" - Print "" - Print "" + Print "" + Print "" + Print "" + Print "" Print "" Print "" Next
Benchmark
[./";cResult!name; "]"; Format(cResult!python, "0.00");" "; Format(cResult!perl, "0.00");" "; Format(cResult!gambas, "0.00");" ";cResult!name; ""; FormatResult(cResult, "python");" "; FormatResult(cResult, "perl");" "; FormatResult(cResult, "gambas");" "; Format(cResult!gambasjit, "0.00");"