Skip to content

pkg/record: Record.Size is redundant with len(Data) #74

Description

@dolmen

From pkg/record/record.go:

// A Record represents the data read from or written to a file descriptor.
type Record struct {
Time time.Time // received time
Fd int // integer file descriptor
Size int // size of data
Data []byte // data
}

Field r.Size is redundant with len(r.Data).

Removing the Size field will reduce memory allocated and could improve throughput. This could also eliminate any risk of mishandling Size vs Data (record.Encode, for example, doesn't do any consistency check).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions