From ce635cc2b140ac7d74e6f579f0d693d81e7c4da1 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Tue, 12 Nov 2024 18:53:03 +0000 Subject: [PATCH] remove wavefront component preallocation --- pkg/types.go | 4 ++-- pkg/wfa.go | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/types.go b/pkg/types.go index 505c849..5cd0ad0 100644 --- a/pkg/types.go +++ b/pkg/types.go @@ -116,7 +116,7 @@ type WavefrontComponent struct { } // NewWavefrontComponent: returns initialized WavefrontComponent -func NewWavefrontComponent(preallocateSize int) *WavefrontComponent { +func NewWavefrontComponent() *WavefrontComponent { // new wavefront component = { // lo = [0] // hi = [0] @@ -130,7 +130,7 @@ func NewWavefrontComponent(preallocateSize int) *WavefrontComponent { }, } - w.W.Preallocate(preallocateSize) + //w.W.Preallocate(preallocateSize) return w } diff --git a/pkg/wfa.go b/pkg/wfa.go index 7c877f1..56e2b48 100644 --- a/pkg/wfa.go +++ b/pkg/wfa.go @@ -10,12 +10,11 @@ func WFAlign(s1 string, s2 string, penalties Penalty, doCIGAR bool) Result { A_k := m - n A_offset := uint32(m) score := 0 - estimatedScore := (max(n, m) * max(penalties.M, penalties.X, penalties.O, penalties.E)) / 4 - M := NewWavefrontComponent(estimatedScore) + M := NewWavefrontComponent() M.SetLoHi(0, 0, 0) M.SetVal(0, 0, 0, End) - I := NewWavefrontComponent(estimatedScore) - D := NewWavefrontComponent(estimatedScore) + I := NewWavefrontComponent() + D := NewWavefrontComponent() for { WFExtend(M, s1, n, s2, m, score)