add simple bench test

This commit is contained in:
legoff.laurent 2010-12-13 14:54:47 +00:00
parent be8e2922d3
commit dae8bc663d
2 changed files with 18 additions and 0 deletions

View file

@ -0,0 +1,14 @@
package main
import (
"fmt"
)
func main() {
toto := make([]int, 2, 2)
toto[0] = 1
toto[1] = 2
fmt.Printf("%v\n", toto);
toto = toto[0:0]
fmt.Printf("%v\n", toto);
fmt.Printf("%v\n", cap(toto));
}

View file

@ -3,6 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"time"
"log" "log"
"os" "os"
"bufio" "bufio"
@ -41,7 +42,10 @@ func main() {
gc.Translate(0, 380) gc.Translate(0, 380)
gc.Scale(1,-1) gc.Scale(1,-1)
gc.Translate(0, -380) gc.Translate(0, -380)
lastTime := time.Nanoseconds()
interpreter := postscript.NewInterpreter(gc) interpreter := postscript.NewInterpreter(gc)
interpreter.ExecuteFile("../../test_files/tiger.ps") interpreter.ExecuteFile("../../test_files/tiger.ps")
dt := time.Nanoseconds() - lastTime
fmt.Printf("Draw image: %f ms\n", float(dt)*1e-6)
saveToPngFile("../../TestPostscript.png", i) saveToPngFile("../../TestPostscript.png", i)
} }