-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbenchmark_test.go
More file actions
36 lines (29 loc) · 830 Bytes
/
benchmark_test.go
File metadata and controls
36 lines (29 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2021 Frederik Zipp. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package pps
import "testing"
func BenchmarkUniverseStep100x100(b *testing.B) {
benchmarkUniverseStep(b, Vec2{X: 100, Y: 100})
}
func BenchmarkUniverseStep250x250(b *testing.B) {
benchmarkUniverseStep(b, Vec2{X: 250, Y: 250})
}
func BenchmarkUniverseStep400x400(b *testing.B) {
benchmarkUniverseStep(b, Vec2{X: 400, Y: 400})
}
func BenchmarkUniverseStep800x800(b *testing.B) {
benchmarkUniverseStep(b, Vec2{X: 800, Y: 800})
}
func benchmarkUniverseStep(b *testing.B, size Vec2) {
params := ParamSet{
Alpha: 180,
Beta: 17,
Velocity: 0.67,
Radius: 5.0,
}
u := NewUniverse(size, int(size.X*size.Y*0.08), params)
for range b.N {
u.Step()
}
}