stackitem: reusable serialization context
We serialize items a lot and this allows to avoid a number of allocations.
This commit is contained in:
parent
3d4076ca36
commit
c3d989ebda
13 changed files with 111 additions and 42 deletions
|
@ -24,7 +24,11 @@ func getConvertibleFromDAO(id int32, d *dao.Simple, key []byte, conv stackitem.C
|
|||
}
|
||||
|
||||
func putConvertibleToDAO(id int32, d *dao.Simple, key []byte, conv stackitem.Convertible) error {
|
||||
data, err := stackitem.SerializeConvertible(conv)
|
||||
item, err := conv.ToStackItem()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
data, err := d.GetItemCtx().Serialize(item, false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue