From 42e99b376ca9a42086c08ae8c8952a3ed301ef31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Sun, 2 Nov 2014 23:10:47 +0000 Subject: [PATCH] [BENCHMARKS] * NEW: Update the 'benchmark.gbs' script. git-svn-id: svn://localhost/gambas/trunk@6606 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- benchmark/benchmark.gbs | 48 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) 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");"