From 06788ff593be092eb85a3d3867ae43c2818cbc5d Mon Sep 17 00:00:00 2001 From: Jian Xiao <99709935+jianoaix@users.noreply.github.com> Date: Mon, 5 Feb 2024 21:18:25 -0800 Subject: [PATCH] Allocate reader buffer more precisely (#245) --- pkg/encoding/utils/pointsIO.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/encoding/utils/pointsIO.go b/pkg/encoding/utils/pointsIO.go index 53cdf279ec..95e9597bb2 100644 --- a/pkg/encoding/utils/pointsIO.go +++ b/pkg/encoding/utils/pointsIO.go @@ -122,7 +122,7 @@ func ReadG1PointSection(filepath string, from, to uint64, numWorker uint64) ([]b n := to - from startTimer := time.Now() - g1r := bufio.NewReaderSize(g1f, int(to*G1PointBytes)) + g1r := bufio.NewReaderSize(g1f, int(n*G1PointBytes)) _, err = g1f.Seek(int64(from)*G1PointBytes, 0) if err != nil { @@ -303,7 +303,7 @@ func ReadG2PointSection(filepath string, from, to uint64, numWorker uint64) ([]b n := to - from startTimer := time.Now() - g2r := bufio.NewReaderSize(g2f, int(to*G2PointBytes)) + g2r := bufio.NewReaderSize(g2f, int(n*G2PointBytes)) _, err = g2f.Seek(int64(from*G2PointBytes), 0) if err != nil {