mirror of
https://github.com/godotengine/godot-benchmarks.git
synced 2026-01-04 06:10:04 +03:00
Add benchmarks for noise (#56)
This commit is contained in:
committed by
GitHub
parent
29ec9d0cfe
commit
42ba8d1999
33
benchmarks/math/noise.gd
Normal file
33
benchmarks/math/noise.gd
Normal file
@@ -0,0 +1,33 @@
|
||||
extends Benchmark
|
||||
|
||||
const NUM_ITERATIONS := 1000000
|
||||
|
||||
func _bench_noise(noise) -> void:
|
||||
for i in NUM_ITERATIONS:
|
||||
noise.get_noise_1d(i)
|
||||
noise.get_noise_2d(i, i)
|
||||
noise.get_noise_3d(i, i, i)
|
||||
|
||||
func _fast_noise(type: FastNoiseLite.NoiseType) -> FastNoiseLite:
|
||||
var noise := FastNoiseLite.new()
|
||||
noise.noise_type = type
|
||||
noise.seed = 234
|
||||
return noise
|
||||
|
||||
func benchmark_value() -> void:
|
||||
return _bench_noise(_fast_noise(FastNoiseLite.TYPE_VALUE))
|
||||
|
||||
func benchmark_value_cubic() -> void:
|
||||
return _bench_noise(_fast_noise(FastNoiseLite.TYPE_VALUE_CUBIC))
|
||||
|
||||
func benchmark_perlin() -> void:
|
||||
return _bench_noise(_fast_noise(FastNoiseLite.TYPE_PERLIN))
|
||||
|
||||
func benchmark_cellular() -> void:
|
||||
return _bench_noise(_fast_noise(FastNoiseLite.TYPE_CELLULAR))
|
||||
|
||||
func benchmark_simplex() -> void:
|
||||
return _bench_noise(_fast_noise(FastNoiseLite.TYPE_SIMPLEX))
|
||||
|
||||
func benchmark_simplex_smooth() -> void:
|
||||
return _bench_noise(_fast_noise(FastNoiseLite.TYPE_SIMPLEX_SMOOTH))
|
||||
Reference in New Issue
Block a user