forked from TrueCloudLab/frostfs-api-go
[#376] object: remove pointer from Attribute slice
``` name old time/op new time/op delta AttributesMarshal/marshal-8 4.44µs ± 9% 2.72µs ± 0% -38.79% (p=0.000 n=10+9) AttributesMarshal/unmarshal-8 3.16µs ±13% 0.55µs ± 4% -82.60% (p=0.000 n=10+10) name old alloc/op new alloc/op delta AttributesMarshal/marshal-8 4.42kB ± 0% 4.42kB ± 0% ~ (all equal) AttributesMarshal/unmarshal-8 2.02kB ± 0% 1.79kB ± 0% -11.11% (p=0.000 n=10+10) name old allocs/op new allocs/op delta AttributesMarshal/marshal-8 51.0 ± 0% 51.0 ± 0% ~ (all equal) AttributesMarshal/unmarshal-8 51.0 ± 0% 1.0 ± 0% -98.04% (p=0.000 n=10+10) ``` Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
204126893e
commit
fadd47f4fb
7 changed files with 26 additions and 36 deletions
|
@ -108,26 +108,20 @@ func WriteNotificationInfo(o *Object, ni NotificationInfo) {
|
|||
attrs = attrs[:len(attrs)-1]
|
||||
}
|
||||
|
||||
notifyAttrs := make([]*Attribute, 0, 2)
|
||||
|
||||
if !changedEpoch {
|
||||
eAttr := new(Attribute)
|
||||
eAttr.SetKey(SysAttributeTickEpoch)
|
||||
eAttr.SetValue(epoch)
|
||||
|
||||
notifyAttrs = append(notifyAttrs, eAttr)
|
||||
index := len(attrs)
|
||||
attrs = append(attrs, Attribute{})
|
||||
attrs[index].SetKey(SysAttributeTickEpoch)
|
||||
attrs[index].SetValue(epoch)
|
||||
}
|
||||
|
||||
if !changedTopic && topic != "" {
|
||||
tAttr := new(Attribute)
|
||||
tAttr.SetKey(SysAttributeTickTopic)
|
||||
tAttr.SetValue(topic)
|
||||
|
||||
notifyAttrs = append(notifyAttrs, tAttr)
|
||||
index := len(attrs)
|
||||
attrs = append(attrs, Attribute{})
|
||||
attrs[index].SetKey(SysAttributeTickTopic)
|
||||
attrs[index].SetValue(topic)
|
||||
}
|
||||
|
||||
attrs = append(attrs, notifyAttrs...)
|
||||
|
||||
h.SetAttributes(attrs)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue