Switch to faster json library go-json and sonic

Former-commit-id: ab9b4723f1dcf79fe5c073fff4d86f4f6969edfd
This commit is contained in:
Eric Coissac
2024-06-23 00:36:08 +02:00
parent 93f9dcb95f
commit c1f03cb1f6
9 changed files with 80 additions and 32 deletions

View File

@@ -2,6 +2,9 @@ package obialign
import (
"math"
"sync"
log "github.com/sirupsen/logrus"
)
var _FourBitsCount = []float64{
@@ -28,6 +31,7 @@ var _InitializedDnaScore = false
var _NucPartMatch [32][32]float64
var _NucScorePartMatchMatch [100][100]int
var _NucScorePartMatchMismatch [100][100]int
var _InitDNAScoreMatrixMutex = &sync.Mutex{}
// _MatchRatio calculates the match ratio between two bytes.
//
@@ -120,7 +124,11 @@ func _InitNucScorePartMatch() {
}
func _InitDNAScoreMatrix() {
_InitDNAScoreMatrixMutex.Lock()
defer _InitDNAScoreMatrixMutex.Unlock()
if !_InitializedDnaScore {
log.Info("Initializing the DNA Scoring matrix")
_InitNucPartMatch()
_InitNucScorePartMatch()
_InitializedDnaScore = true