Browse Source

Fix a small issue with colors

main
meutraa 7 months ago
parent
commit
0380a21e4c
Signed by: meutraa GPG Key ID: 82664A5F8DAC3400
  1. 32
      benchmarks.md
  2. 45
      main.go

32
benchmarks.md

@ -151,4 +151,34 @@ Showing top 25 nodes out of 172
50ms 1.27% 64.30% 50ms 1.27% runtime.runqgrab
40ms 1.01% 65.32% 40ms 1.01% github.com/jfreymuth/oggvorbis.crcUpdate
40ms 1.01% 66.33% 40ms 1.01% github.com/jfreymuth/vorbis.renderLine
40ms 1.01% 67.34% 40ms 1.01% runtime.memclrNoHeapPointers
40ms 1.01% 67.34% 40ms 1.01% runtime.memclrNoHeapPointers
Showing nodes accounting for 2020ms, 68.71% of 2940ms total
Dropped 53 nodes (cum <= 14.70ms)
Showing top 25 nodes out of 126
flat flat% sum% cum cum%
450ms 15.31% 15.31% 450ms 15.31% runtime.futex
230ms 7.82% 23.13% 230ms 7.82% [libspa-audioconvert.so]
190ms 6.46% 29.59% 890ms 30.27% runtime.findrunnable
110ms 3.74% 33.33% 130ms 4.42% runtime.cgocall
100ms 3.40% 36.73% 320ms 10.88% github.com/hajimehoshi/oto/internal/mux.(*Mux).Read
90ms 3.06% 39.80% 300ms 10.20% github.com/faiface/beep.signedToFloat
90ms 3.06% 42.86% 120ms 4.08% math.ldexp
80ms 2.72% 45.58% 90ms 3.06% runtime.nanotime (inline)
70ms 2.38% 47.96% 70ms 2.38% [libpthread-2.32.so]
70ms 2.38% 50.34% 190ms 6.46% math.expmulti
60ms 2.04% 52.38% 60ms 2.04% runtime.pMask.read (inline)
60ms 2.04% 54.42% 70ms 2.38% syscall.Syscall
50ms 1.70% 56.12% 370ms 12.59% github.com/faiface/beep.Format.decode
40ms 1.36% 57.48% 40ms 1.36% runtime.(*randomEnum).done (inline)
30ms 1.02% 58.50% 30ms 1.02% [libc-2.32.so]
30ms 1.02% 59.52% 550ms 18.71% github.com/faiface/beep/speaker.update
30ms 1.02% 60.54% 30ms 1.02% math.IsInf (inline)
30ms 1.02% 61.56% 30ms 1.02% runtime.(*guintptr).cas (inline)
30ms 1.02% 62.59% 200ms 6.80% runtime.checkTimers
30ms 1.02% 63.61% 30ms 1.02% runtime.dodeltimer0
30ms 1.02% 64.63% 30ms 1.02% runtime.epollwait
30ms 1.02% 65.65% 30ms 1.02% runtime.execute
30ms 1.02% 66.67% 40ms 1.36% runtime.lock2
30ms 1.02% 67.69% 70ms 2.38% runtime.netpoll
30ms 1.02% 68.71% 1190ms 40.48% runtime.schedule

45
main.go

@ -194,21 +194,6 @@ func run() error {
var totalHits uint64 = 0
inputs := []game.Input{}
finished := false
go func() {
time.Sleep(*config.Delay + *config.Offset)
speaker.Play(streamer)
song := buffer.Streamer(0, buffer.Len())
speaker.Play(song)
for {
if song.Position() == song.Len() {
quitChannel <- os.Interrupt
}
time.Sleep(time.Second)
}
}()
// Render the hit bar
for i := uint8(0); i < chart.Difficulty.NKeys; i++ {
r.Fill(totalRows-*config.BarOffsetFromBottom, getColumn(chart.Difficulty.NKeys, middleColumn, i), th.RenderHitField(i))
@ -225,7 +210,19 @@ func run() error {
r.Fill(uint16(18+i), sideCol, judgement.Name+": ")
}
// I do not care about all the above, it is instantish
go func() {
time.Sleep(*config.Delay + *config.Offset)
song := buffer.Streamer(0, buffer.Len())
speaker.Play(song)
for {
if song.Position() == song.Len() {
quitChannel <- os.Interrupt
}
time.Sleep(time.Second)
}
}()
// I do not care about all the above, it does not affect gameplay
if *config.CpuProfile != "" {
f, err := os.Create(*config.CpuProfile)
if err != nil {
@ -237,9 +234,7 @@ func run() error {
r.RenderLoop(*config.Delay,
func(startTime time.Time, duration time.Duration) bool {
// This fails if the last note is not meant to be hit
if len(quitChannel) != 0 {
finished = true
return false
}
@ -338,10 +333,10 @@ func run() error {
eidx := len(counts) - 1
counts[eidx] += 1
r.Fill(uint16(18+eidx), sideColData, fmt.Sprintf("%6v", counts[eidx]))
r.AddDecoration(col-1, middleRow-1, "\033[1;31m╭", 240)
r.AddDecoration(col+1, middleRow-1, "\033[1;31m╮", 240)
r.AddDecoration(col-1, middleRow, "\033[1;31m╰", 240)
r.AddDecoration(col+1, middleRow, "\033[1;31m╯", 240)
r.AddDecoration(col-1, middleRow-1, "\033[1;31m╭\033[0m", 240)
r.AddDecoration(col+1, middleRow-1, "\033[1;31m╮\033[0m", 240)
r.AddDecoration(col-1, middleRow, "\033[1;31m╰\033[0m", 240)
r.AddDecoration(col+1, middleRow, "\033[1;31m╯\033[0m", 240)
}
// Mark the active window to slide forward 1
@ -401,10 +396,6 @@ func run() error {
},
)
if finished && len(quitChannel) == 0 {
scorer.Save(chart, &inputs, *config.Rate)
log.Println("saved")
_, _ = <-in, <-in
}
scorer.Save(chart, &inputs, *config.Rate)
return nil
}
Loading…
Cancel
Save