From 504fe3db47c058807b656a8e63bb27c12420f268 Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Tue, 31 Aug 2021 16:28:07 +0200 Subject: join too small temp chunks with previous one if possible --- sketch.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'sketch.go') diff --git a/sketch.go b/sketch.go index 9910848..c88f043 100644 --- a/sketch.go +++ b/sketch.go @@ -16,7 +16,7 @@ const fBytes = 8 // sfCount: the number of super-features, and fCount: the number of feature // per super-feature func SketchChunk(chunk Chunk, wSize int, sfCount int, fCount int) (Sketch, error) { - var fSize = chunkSize / (sfCount * fCount) + var fSize = FeatureSize(chunkSize, sfCount, fCount) superfeatures := make([]uint64, 0, sfCount) features := make([]uint64, 0, fCount*sfCount) buff := make([]byte, fBytes*fCount) @@ -49,3 +49,11 @@ func SketchChunk(chunk Chunk, wSize int, sfCount int, fCount int) (Sketch, error } return superfeatures, nil } + +func SuperFeatureSize(chunkSize int, sfCount int, fCount int) int { + return FeatureSize(chunkSize, sfCount, fCount) * sfCount +} + +func FeatureSize(chunkSize int, sfCount int, fCount int) int { + return chunkSize / (sfCount * fCount) +} -- cgit v1.2.3