mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-07 15:07:36 +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
15
pkg/vm/stackitem/reference.go
Normal file
15
pkg/vm/stackitem/reference.go
Normal file
|
@ -0,0 +1,15 @@
|
|||
package stackitem
|
||||
|
||||
type rc struct {
|
||||
count int
|
||||
}
|
||||
|
||||
func (r *rc) IncRC() int {
|
||||
r.count++
|
||||
return r.count
|
||||
}
|
||||
|
||||
func (r *rc) DecRC() int {
|
||||
r.count--
|
||||
return r.count
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue