You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Dart_GetField is 2ms of each frame in the gallery weather demo #3808
BTW, I have been discussing with some folks that if Dart had an FFI-centric bindings instead of API-centric bindings then this kind of overhead (like Dart_GetField) would disappear.
In FFI-centric bindings you will describe marshaling rules on the Dart side instead of having them on the C++-side. Having marshaling rules on Dart side allows us to generate specialized marshaling stubs dynamically leading to a very good performance.
For example we could allow writing something like this:
// This ffi.Signature is some sort of description of how arguments are marshaled.@ffi.Signature("void foo (struct { double offset._dx, double offset._dy })")
voidfoo(OffsetBase offset) native"foo";
// foo is a C++ method that is invoked directly with appropriate arguments. // it does not need to use Dart API to marshall any data.
The hardest part is actually deciding on format for these signature descriptions.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
eseidelGoogle commentedon May 9, 2016
Most of them are for Paint._value, although there are several other field names represented.
abarth commentedon May 9, 2016
Yeah, I didn't do
Paint._valuein my previous pass. I can do that one too.eseidelGoogle commentedon May 9, 2016
Counts of GetField calls under Paint phase in that trace:
73 "Paint._value"
6 "OffsetBase._dy"
6 "OffsetBase._dx"
4 "Color._value"
2 "TransferMode.index"
2 "Point.y"
2 "Point.x"
abarth commentedon May 9, 2016
I think the solution here is to record the canvas commands into a ByteData buffer in Dart and then move all the commands into C++ in one operation.
mraleph commentedon May 16, 2016
BTW, I have been discussing with some folks that if Dart had an FFI-centric bindings instead of API-centric bindings then this kind of overhead (like
Dart_GetField) would disappear.In FFI-centric bindings you will describe marshaling rules on the Dart side instead of having them on the C++-side. Having marshaling rules on Dart side allows us to generate specialized marshaling stubs dynamically leading to a very good performance.
For example we could allow writing something like this:
The hardest part is actually deciding on format for these signature descriptions.
abarth commentedon May 16, 2016
Interesting. I've been experimenting with doing something like that manually by encoding the arguments into a typed array.
abarth commentedon May 16, 2016
https://github.com/flutter/engine/compare/master...abarth:encoded_buffer?expand=1 is an example with encoding into typed arrays. Unfortunately, it didn't seem to be measurably faster.
abarth commentedon Jun 20, 2016
Canvas no longer calls Dart_GetField.
github-actions commentedon Aug 15, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.