gio-v
gio-v copied to clipboard
An easy benchmark to add:
Here's an easy benchmark to see the impact of the Layout
. Making forks etc. is slightly annoying, so this is a faster way to do it :D.
package main
import (
"gio-v/wid"
"image"
"testing"
"gioui.org/font/gofont"
"gioui.org/io/router"
"gioui.org/io/system"
"gioui.org/layout"
"gioui.org/op"
)
func BenchmarkLayout(b *testing.B) {
makePersons()
currentTheme = wid.NewTheme(gofont.Collection(), 14, wid.MaterialDesignLight)
setup()
b.ResetTimer()
b.ReportAllocs()
var ops op.Ops
var r router.Router
for i := 0; i < b.N; i++ {
gtx := layout.NewContext(&ops, system.FrameEvent{
Size: image.Point{
X: 1024,
Y: 1024,
},
Queue: &r,
})
wid.Root(gtx)
}
}