Roman Khimov
1b83dc2476
*: improve for loop syntax
...
Mostly it's about Go 1.22+ syntax with ranging over integers, but it also
prefers ranging over slices where possible (it makes code a little better to
read).
Notice that we have a number of dangerous loops where slices are mutated
during loop execution, many of these can't be converted since we need proper
length evalutation at every iteration.
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-30 21:45:18 +03:00
Anna Shaleva
6b21ad9922
*: replace interface{}
with any
keyword
...
Everywhere including examples, external interop APIs, bindings generators
code and in other valuable places. A couple of `interface{}` usages are
intentionally left in the CHANGELOG.md, documentation and tests.
2023-04-04 13:22:42 +03:00
Roman Khimov
13f5fdbe8a
vm: extract shared parts of the Context
...
Local calls reuse them, cross-contract calls create new ones. This allows to
avoid some allocations and use a little less memory.
2022-08-05 14:26:25 +03:00
Anna Shaleva
42a051e55a
core: DeepCopy notifiction event args inside System.Runtime.Notify
2022-05-31 08:07:53 +03:00
Anna Shaleva
7296f0c913
vm: support immutable compound types
2022-05-31 08:07:50 +03:00
Roman Khimov
0d93b353e6
vm: count initial Null slot variables as well
...
Match C# behavior. Thanks to @ixje for finding this.
2022-05-16 17:42:57 +03:00
Roman Khimov
ee05f73b6f
vm: simplify slot and make it private
...
Hiding refcounter inside a slot is actually a good idea, but it makes the
structure somewhat bigger, especially given that the refcounter is the same
and belongs more to VM or Context. New structure is a bit more efficient:
name old time/op new time/op delta
ScriptFibonacci-8 672µs ± 2% 644µs ± 0% -4.15% (p=0.008 n=5+5)
ScriptNestedRefCount-8 1.08ms ± 1% 1.05ms ± 2% -2.56% (p=0.008 n=5+5)
ScriptPushPop/4-8 1.52µs ± 1% 1.47µs ± 1% -3.14% (p=0.008 n=5+5)
ScriptPushPop/16-8 3.66µs ± 1% 3.54µs ± 1% -3.24% (p=0.008 n=5+5)
ScriptPushPop/128-8 24.7µs ± 1% 23.2µs ± 1% -6.14% (p=0.008 n=5+5)
ScriptPushPop/1024-8 183µs ± 1% 173µs ± 1% -5.01% (p=0.008 n=5+5)
name old alloc/op new alloc/op delta
ScriptFibonacci-8 114kB ± 0% 114kB ± 0% ~ (p=0.079 n=4+5)
ScriptNestedRefCount-8 241kB ± 0% 241kB ± 0% ~ (p=0.333 n=5+4)
ScriptPushPop/4-8 160B ± 0% 160B ± 0% ~ (all equal)
ScriptPushPop/16-8 640B ± 0% 640B ± 0% ~ (all equal)
ScriptPushPop/128-8 8.70kB ± 0% 8.70kB ± 0% ~ (all equal)
ScriptPushPop/1024-8 73.2kB ± 0% 73.2kB ± 0% ~ (all equal)
name old allocs/op new allocs/op delta
ScriptFibonacci-8 3.17k ± 0% 3.17k ± 0% -0.03% (p=0.008 n=5+5)
ScriptNestedRefCount-8 10.7k ± 0% 10.7k ± 0% ~ (all equal)
ScriptPushPop/4-8 8.00 ± 0% 8.00 ± 0% ~ (all equal)
ScriptPushPop/16-8 32.0 ± 0% 32.0 ± 0% ~ (all equal)
ScriptPushPop/128-8 259 ± 0% 259 ± 0% ~ (all equal)
ScriptPushPop/1024-8 2.05k ± 0% 2.05k ± 0% ~ (all equal)
It'd be especially nice to internalize static slot, but as we can't compare
slices it's not possible.
2021-12-01 21:36:25 +03:00
Evgeniy Stratonikov
dc393642a2
opcode: fix GTE, LTE string representations
2021-04-29 16:08:48 +03:00
Roman Khimov
0709e20fbb
vm: add opcode benchmark
...
For future optimizations and price adjustments.
2020-10-15 16:27:36 +03:00