fix: bogoflops counter being overestimated on M4 Mac due to Math.random() reliance

This commit is contained in:
minjaesong
2025-11-27 10:41:13 +09:00
parent 767aa09a17
commit e14e689dce
4 changed files with 63 additions and 23 deletions

View File

@@ -254,18 +254,10 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
//loadDone = true
// measure bogoflops here
val st = System.nanoTime()
var sc = st
var bogoflopf = Math.random()
var bogoflops = 0L
while (sc - st < 100000000L) {
bogoflopf *= Math.random()
bogoflops++
sc = System.nanoTime()
}
bogoflops = Math.round(bogoflops.toDouble() * (1000000000.0 / (sc - st)))
printdbg(this, "Bogoflops old: ${App.bogoflops} new: $bogoflops")
App.bogoflops = maxOf(App.bogoflops, bogoflops)
val bogoflopsOld = App.bogoflops
App.updateBogoflops(100_000_000L)
printdbg(this, "Bogoflops old: $bogoflopsOld new: ${App.bogoflops}")
App.bogoflops = maxOf(App.bogoflops, bogoflopsOld)
App.audioMixer.ambientTracks.forEach {