[#376] acl: Replace slices of pointers with raw structs
``` name old time/op new time/op delta Table_ToGRPCMessage/to_grpc_message-8 2.82µs ± 5% 2.86µs ± 5% ~ (p=0.395 n=10+8) Table_ToGRPCMessage/from_grpc_message-8 2.47µs ± 5% 1.08µs ± 6% -56.16% (p=0.000 n=9+9) name old alloc/op new alloc/op delta Table_ToGRPCMessage/to_grpc_message-8 3.31kB ± 0% 3.31kB ± 0% ~ (all equal) Table_ToGRPCMessage/from_grpc_message-8 1.82kB ± 0% 1.38kB ± 0% -24.56% (p=0.000 n=10+10) name old allocs/op new allocs/op delta Table_ToGRPCMessage/to_grpc_message-8 46.0 ± 0% 46.0 ± 0% ~ (all equal) Table_ToGRPCMessage/from_grpc_message-8 45.0 ± 0% 9.0 ± 0% -80.00% (p=0.000 n=10+10) ``` Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
4a70c42104
commit
ec484f2fd2
5 changed files with 44 additions and 63 deletions
|
@ -67,7 +67,7 @@ func (t *Table) StableMarshal(buf []byte) ([]byte, error) {
|
|||
offset += n
|
||||
|
||||
for i := range t.records {
|
||||
n, err = protoutil.NestedStructureMarshal(tableRecordsField, buf[offset:], t.records[i])
|
||||
n, err = protoutil.NestedStructureMarshal(tableRecordsField, buf[offset:], &t.records[i])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ func (t *Table) StableSize() (size int) {
|
|||
size += protoutil.NestedStructureSize(tableContainerIDField, t.cid)
|
||||
|
||||
for i := range t.records {
|
||||
size += protoutil.NestedStructureSize(tableRecordsField, t.records[i])
|
||||
size += protoutil.NestedStructureSize(tableRecordsField, &t.records[i])
|
||||
}
|
||||
|
||||
return size
|
||||
|
@ -129,7 +129,7 @@ func (r *Record) StableMarshal(buf []byte) ([]byte, error) {
|
|||
offset += n
|
||||
|
||||
for i := range r.filters {
|
||||
n, err = protoutil.NestedStructureMarshal(recordFiltersField, buf[offset:], r.filters[i])
|
||||
n, err = protoutil.NestedStructureMarshal(recordFiltersField, buf[offset:], &r.filters[i])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ func (r *Record) StableMarshal(buf []byte) ([]byte, error) {
|
|||
}
|
||||
|
||||
for i := range r.targets {
|
||||
n, err = protoutil.NestedStructureMarshal(recordTargetsField, buf[offset:], r.targets[i])
|
||||
n, err = protoutil.NestedStructureMarshal(recordTargetsField, buf[offset:], &r.targets[i])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -159,11 +159,11 @@ func (r *Record) StableSize() (size int) {
|
|||
size += protoutil.EnumSize(recordActionField, int32(r.action))
|
||||
|
||||
for i := range r.filters {
|
||||
size += protoutil.NestedStructureSize(recordFiltersField, r.filters[i])
|
||||
size += protoutil.NestedStructureSize(recordFiltersField, &r.filters[i])
|
||||
}
|
||||
|
||||
for i := range r.targets {
|
||||
size += protoutil.NestedStructureSize(recordTargetsField, r.targets[i])
|
||||
size += protoutil.NestedStructureSize(recordTargetsField, &r.targets[i])
|
||||
}
|
||||
|
||||
return size
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue