Skip to content

Commit

Permalink
Allocate reader buffer more precisely (Layr-Labs#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
jianoaix authored Feb 6, 2024
1 parent bdfcf8c commit 06788ff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/encoding/utils/pointsIO.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 06788ff

Please sign in to comment.