add simple bench test
This commit is contained in:
parent
be8e2922d3
commit
dae8bc663d
2 changed files with 18 additions and 0 deletions
14
postscript-go/src/cmd/test.go
Normal file
14
postscript-go/src/cmd/test.go
Normal 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));
|
||||||
|
}
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue