fix(vips): memory inconsistency

This commit is contained in:
Tomas Aparicio 2015-04-07 11:25:54 +02:00
parent bc88532806
commit 34dda8c57c
6 changed files with 51 additions and 8 deletions

View file

@ -3,6 +3,7 @@ package bimg
import (
"io/ioutil"
"os"
"path"
"testing"
)
@ -132,3 +133,27 @@ func TestResizePngWithTransparency(t *testing.T) {
t.Fatal("Cannot save the image")
}
}
func benchmarkResize(file string, o Options, b *testing.B) {
buf, _ := Read(path.Join("fixtures", file))
for n := 0; n < b.N; n++ {
Resize(buf, o)
}
}
func BenchmarkResizeLargeJpeg(b *testing.B) {
options := Options{
Width: 800,
Height: 600,
}
benchmarkResize("test.jpg", options, b)
}
func BenchmarkResizePng(b *testing.B) {
options := Options{
Width: 200,
Height: 200,
}
benchmarkResize("test.png", options, b)
}