Reduce gc target percentage

This commit is contained in:
Lou Knauer 2022-03-09 14:21:03 +01:00
parent 720924a7dd
commit 0b66f7c5d7
2 changed files with 6 additions and 2 deletions

View File

@ -9,6 +9,8 @@ import (
"log"
"os"
"os/signal"
"runtime"
"runtime/debug"
"sync"
"syscall"
"time"
@ -240,6 +242,8 @@ func main() {
log.Printf("Checkpoints loaded (%d files, that took %dms)\n", files, time.Since(startupTime).Milliseconds())
}
runtime.GC()
debug.SetGCPercent(20)
ctx, shutdown := context.WithCancel(context.Background())
var wg sync.WaitGroup

View File

@ -23,7 +23,7 @@ func (f Float) MarshalJSON() ([]byte, error) {
return nullAsBytes, nil
}
return strconv.AppendFloat(make([]byte, 0, 10), float64(f), 'f', 1, 32), nil
return strconv.AppendFloat(make([]byte, 0, 10), float64(f), 'f', -1, 64), nil
}
func (f *Float) UnmarshalJSON(input []byte) error {
@ -54,7 +54,7 @@ func (fa FloatArray) MarshalJSON() ([]byte, error) {
if fa[i].IsNaN() {
buf = append(buf, `null`...)
} else {
buf = strconv.AppendFloat(buf, float64(fa[i]), 'f', 1, 32)
buf = strconv.AppendFloat(buf, float64(fa[i]), 'f', -1, 64)
}
}