stackitem: reusable serialization context

We serialize items a lot and this allows to avoid a number of allocations.
This commit is contained in:
Roman Khimov 2022-05-31 20:10:20 +03:00
parent 3d4076ca36
commit c3d989ebda
13 changed files with 111 additions and 42 deletions

View file

@ -364,13 +364,14 @@ func (o *Oracle) RequestInternal(ic *interop.Context, url string, filter *string
return err
}
data, err := stackitem.Serialize(userData)
data, err := ic.DAO.GetItemCtx().Serialize(userData, false)
if err != nil {
return err
}
if len(data) > maxUserDataLength {
return ErrBigArgument
}
data = slice.Copy(data) // Serialization context will be used in PutRequestInternal again.
var filterNotif stackitem.Item
if filter != nil {