What is the performance of Dart and Javascript interop?


I’m concerned about writing a Dart program where I need to interop with the D3 javascript library. A lot of data needs to be accessed from javascript but I would want to store that data in dart, my concern is there any performance problem between Dart and Javascript?


My answer relies on experience rather than factual knowledge. I use dart and d3 as well (dart as a structured data layer, d3 as a render layer). I created 2-3 plots with around 10.000 points per plot which I supplied from dart (js-interop) as a json encoded string (so around 20.000-30.000 points in the DOM). The passing of the data however takes no time. It is directly available in the scope. At least I could not notice any particular delay between passing the data and starting to render the plot. I might retest this with 1M points to be sure. At such huge numbers the browser itself is your main concern.

Hope somebody from the dart-lang team gives some insights. Is the data cloned (that’s my guess since it is of course not bound to the state of the equivalent data in dart) ?

Answered By – ins0m

Answer Checked By – Terry (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *