remove wavefront component preallocation

This commit is contained in:
Arthur Lu 2024-11-12 18:53:03 +00:00
parent f5d2528e20
commit ce635cc2b1
2 changed files with 5 additions and 6 deletions

View File

@ -116,7 +116,7 @@ type WavefrontComponent struct {
} }
// NewWavefrontComponent: returns initialized WavefrontComponent // NewWavefrontComponent: returns initialized WavefrontComponent
func NewWavefrontComponent(preallocateSize int) *WavefrontComponent { func NewWavefrontComponent() *WavefrontComponent {
// new wavefront component = { // new wavefront component = {
// lo = [0] // lo = [0]
// hi = [0] // hi = [0]
@ -130,7 +130,7 @@ func NewWavefrontComponent(preallocateSize int) *WavefrontComponent {
}, },
} }
w.W.Preallocate(preallocateSize) //w.W.Preallocate(preallocateSize)
return w return w
} }

View File

@ -10,12 +10,11 @@ func WFAlign(s1 string, s2 string, penalties Penalty, doCIGAR bool) Result {
A_k := m - n A_k := m - n
A_offset := uint32(m) A_offset := uint32(m)
score := 0 score := 0
estimatedScore := (max(n, m) * max(penalties.M, penalties.X, penalties.O, penalties.E)) / 4 M := NewWavefrontComponent()
M := NewWavefrontComponent(estimatedScore)
M.SetLoHi(0, 0, 0) M.SetLoHi(0, 0, 0)
M.SetVal(0, 0, 0, End) M.SetVal(0, 0, 0, End)
I := NewWavefrontComponent(estimatedScore) I := NewWavefrontComponent()
D := NewWavefrontComponent(estimatedScore) D := NewWavefrontComponent()
for { for {
WFExtend(M, s1, n, s2, m, score) WFExtend(M, s1, n, s2, m, score)