Bench is a helper-function to easily benchmark one frame, given a preload / setup function
(b *testing.B, preload func(), setup func(w *World))
| 483 | |
| 484 | // Bench is a helper-function to easily benchmark one frame, given a preload / setup function |
| 485 | func Bench(b *testing.B, preload func(), setup func(w *World)) { |
| 486 | w := &World{} |
| 487 | |
| 488 | preload() |
| 489 | setup(w) |
| 490 | |
| 491 | b.ResetTimer() |
| 492 | b.ReportAllocs() |
| 493 | for i := 0; i < b.N; i++ { |
| 494 | w.Update(1 / 120) // 120 fps |
| 495 | } |
| 496 | } |
| 497 | |
| 498 | func BenchmarkNewBasic(b *testing.B) { |
| 499 | for i := 0; i < b.N; i++ { |
no test coverage detected
searching dependent graphs…