Dart react performance issues related to jsinterop

223 views
Skip to first unread message

Samuel Hapak

unread,
May 24, 2015, 1:32:49 PM5/24/15
to mi...@dartlang.org, Seth Ladd
Hi guys,
we are discussing some performance issue https://github.com/cleandart/react-dart/issues/49 and it seems like it is somehow connected to dart:js. I do not understand how dart:js works in depth and I think somebody from dart:js could provide some more helpful insights about this. Could somebody please look at that issue and help us? I would be really grateful for your insights guys!

Thanks,

Samuel

Justin Fagnani

unread,
May 24, 2015, 5:35:30 PM5/24/15
to General Dart Discussion, Seth Ladd

There's not much information on that issue. Is this dart2js or Dartium. Dartium will be slower. Also, are you doing copying of data structures with jsify() or passing functions across the language boundary?

As John McCutchan says, a benchmark is key.

I'll take a closer look when there's more.

Cheers,
  Justin

--
For other discussions, see https://groups.google.com/a/dartlang.org/
 
For HOWTO questions, visit http://stackoverflow.com/tags/dart
 
To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.

Jim Trainor

unread,
May 25, 2015, 5:36:28 AM5/25/15
to mi...@dartlang.org
I have a simple benchmark that measures dart <-> js performance as part of a small package that facilitates calling dart from javascript.  A single function between dart and javascript is on the order of a couple of microseconds. It could get slower as you add more arguments or large data objects that needs to be jsified.



Justin Fagnani

unread,
May 25, 2015, 6:11:01 PM5/25/15
to General Dart Discussion
Oh, I somehow missed the benchmark. I didn't see if t was run in Dartium or dart2js though. It should definitely be run in dart2js.

Stephen Adams

unread,
May 26, 2015, 2:34:07 AM5/26/15
to General Dart Discussion
On Mon, May 25, 2015 at 3:10 PM, 'Justin Fagnani' via Dart Misc <mi...@dartlang.org> wrote:
Oh, I somehow missed the benchmark. I didn't see if t was run in Dartium or dart2js though. It should definitely be run in dart2js.

​Jim's benchmark has results for Dartium and dart2js, visible when you scroll down.

The original message points to the thread https://github.com/cleandart/react-dart/issues/49  which has a link to this benchmark which is definitely run on dart2js:
Some nice screen shots, but not quite containing enough information to fully support the diagnosis (no sum of 'own' time over dart:js frames) but looks like a good place to start.  We will need to run it locally.

I have one change open that improves constructor calls: https://codereview.chromium.org/1152673003/
I doubt that will make much difference on this benchmark, but if the benchmark actually does depend on call performance instead of copying lots of data, I think a similar change for calls will improve plain call performance.

Alexandre Ardhuin

unread,
May 26, 2015, 3:21:51 AM5/26/15
to General Dart Discussion
Hi all,

I've also taken a look at this issue.
You can find at https://github.com/a14n/dart_js_test_with_react/blob/master/web/dart-1.dart the dart:js root version (without the react package).
You can also compare the 2 version online:

I definitely see a diff about 30% in FPS (~30fps with dart vs. ~43fps with pure js on my machine). I suspect the convertToDart function (that is used to handle transferable types - see https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:js ) to be part of the issue.

Cheers,
Alexandre



Samuel Hapak

unread,
May 27, 2015, 5:10:58 AM5/27/15
to mi...@dartlang.org
Thank to all of you folks! I am gonna take a deeper look to your insights. Thanks!

Alexandre Ardhuin

unread,
May 27, 2015, 6:48:44 AM5/27/15
to General Dart Discussion
@Stephen : did you try your CL on this example? Do you see some improvements?

Alexandre

2015-05-27 11:10 GMT+02:00 Samuel Hapak <samuel...@gmail.com>:
Thank to all of you folks! I am gonna take a deeper look to your insights. Thanks!

--
Reply all
Reply to author
Forward
0 new messages