Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master-n3 #4518 +/- ##
=============================================
+ Coverage 78.76% 78.89% +0.13%
=============================================
Files 236 236
Lines 16283 16365 +82
Branches 2361 2373 +12
=============================================
+ Hits 12825 12911 +86
+ Misses 2708 2700 -8
- Partials 750 754 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| for (int i = 0; i < parameterCount; i++) | ||
| { | ||
| context.EvaluationStack.Pop(); | ||
| } |
There was a problem hiding this comment.
Wouldn't it be better to move this into the finally block so that if a failure occurs the parameters don't remain on the stack?
There was a problem hiding this comment.
but this can not be "fixed" as its the exsiting logic, this pr shall not change any exsiting logic
shargon
left a comment
There was a problem hiding this comment.
We need benchmarks, maybe the expression is slower
Environment
Summary
|
|
Syscall_OneArg how can be less percentage if it's possitive? |
its not, but i think 0.xx% should be considered a reasonable margin of error? |
|
Have we started optimizing operations at the nanosecond level? |
I am basically still focusing on optimizing the performance of resync the whole ledger, which will cost hours even days, native contract invoking is one of the hotpath of that. Another hotpath is persistance. |
| if (i == 0 && NeedApplicationEngine) | ||
| { | ||
| callParameters[i] = Expression.Convert(engine, handlerParameters[i].ParameterType); | ||
| continue; | ||
| } | ||
|
|
||
| if (i == 0 && NeedSnapshot) |
Description
This change removes the reflection-based hot path from native contract dispatch on
master-n3.InteropDescriptorandContractMethodMetadatanow build cached compiled invokers once, and the runtime dispatch loops inApplicationEngine.OnSysCall(...)andNativeContract.Invoke(...)reuse pooledobject?[]buffers instead of allocating fresh arrays and lists on every invocation.The optimization keeps the previous behavior intact, including
TargetInvocationExceptionwrapping semantics, and adds unit coverage for the new invoker layer.Change Log
InteropInvokerNativeMethodInvokerInteropDescriptorContractMethodMetadataApplicationEngine.OnSysCall(...)NativeContract.Invoke(...)tests/Neo.UnitTests/SmartContract/UT_InteropDescriptor.cstests/Neo.UnitTests/SmartContract/Native/UT_ContractMethodAttribute.csFixes # (issue) - no GitHub issue is linked for this profiling finding.
Type of change
How Has This Been Tested?
Verification commands:
dotnet test tests/Neo.UnitTests/Neo.UnitTests.csproj --filter UT_InteropDescriptor --logger "console;verbosity=minimal"dotnet test tests/Neo.UnitTests/Neo.UnitTests.csproj --filter UT_ContractMethodAttribute --logger "console;verbosity=minimal"dotnet test tests/Neo.UnitTests/Neo.UnitTests.csproj --logger "console;verbosity=minimal"Benchmark results from an external harness that executes
GAS.totalSupply()through the real native dispatch path (200 executions x 1000 calls = 200000 native dispatches):origin/master-n3):elapsed_ms=2457.30,allocated_bytes=1001359680fix-native-dispatch-delegates):elapsed_ms=2240.74,allocated_bytes=964599232Checklist: