mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-14 18:05:55 -07:00
fix(vips): memory inconsistency
This commit is contained in:
parent
bc88532806
commit
34dda8c57c
6 changed files with 51 additions and 8 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue