mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-06 19:55:10 +00:00
vm: embed reference counter in compound items
``` name old time/op new time/op delta RefCounter_Add-8 44.8ns ± 4% 11.7ns ± 3% -73.94% (p=0.000 n=10+10) ``` Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
dc9287bf5c
commit
4f98ec2f53
7 changed files with 99 additions and 55 deletions
|
@ -208,6 +208,28 @@ func compareItems(t *testing.T, a, b stackitem.Item) {
|
|||
p, ok := b.(*stackitem.Pointer)
|
||||
require.True(t, ok)
|
||||
require.Equal(t, si.Position(), p.Position()) // there no script in test files
|
||||
case *stackitem.Array, *stackitem.Struct:
|
||||
require.Equal(t, a.Type(), b.Type())
|
||||
|
||||
as := a.Value().([]stackitem.Item)
|
||||
bs := a.Value().([]stackitem.Item)
|
||||
require.Equal(t, len(as), len(bs))
|
||||
|
||||
for i := range as {
|
||||
compareItems(t, as[i], bs[i])
|
||||
}
|
||||
|
||||
case *stackitem.Map:
|
||||
require.Equal(t, a.Type(), b.Type())
|
||||
|
||||
as := a.Value().([]stackitem.MapElement)
|
||||
bs := a.Value().([]stackitem.MapElement)
|
||||
require.Equal(t, len(as), len(bs))
|
||||
|
||||
for i := range as {
|
||||
compareItems(t, as[i].Key, bs[i].Key)
|
||||
compareItems(t, as[i].Value, bs[i].Value)
|
||||
}
|
||||
default:
|
||||
require.Equal(t, a, b)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue