Skip to content

Commit

Permalink
improve comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Wondertan committed Jul 25, 2024
1 parent bd7ee98 commit 3a90b77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions store/file/ods.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ import (

var _ eds.AccessorStreamer = (*ODSFile)(nil)

// writeBufferSize defines buffer size for optimized batched writes into the file system.
// TODO(@Wondertan): Consider making it configurable and default being dynamic based on square size
const writeBufferSize = 64 << 10

// ErrEmptyFile signals that the ODS file is empty.
// This helps avoid storing empty block EDSes.
var ErrEmptyFile = errors.New("file is empty")
Expand Down Expand Up @@ -61,8 +65,6 @@ func OpenODSFile(path string) (*ODSFile, error) {
}, nil
}

const bufSize = 64 << 10

// CreateODSFile creates a new file. File has to be closed after usage.
func CreateODSFile(
path string,
Expand All @@ -76,7 +78,7 @@ func CreateODSFile(
}

// buffering gives us ~4x speed up
buf := bufio.NewWriterSize(f, bufSize)
buf := bufio.NewWriterSize(f, writeBufferSize)

h, err := writeODSFile(buf, eds, roots)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion store/file/q1q4_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func CreateQ1Q4File(path string, roots *share.AxisRoots, eds *rsmt2d.ExtendedDat
}

// buffering gives us ~4x speed up
buf := bufio.NewWriterSize(ods.fl, bufSize)
buf := bufio.NewWriterSize(ods.fl, writeBufferSize)

err = writeQ4(buf, eds)
if err != nil {
Expand Down

0 comments on commit 3a90b77

Please sign in to comment.