Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boggle solver 2.1X slower on dart2js than Dart VM #9255

Closed
sethladd opened this issue Mar 19, 2013 · 16 comments
Closed

Boggle solver 2.1X slower on dart2js than Dart VM #9255

sethladd opened this issue Mar 19, 2013 · 16 comments
Assignees
Labels
closed-obsolete Closed as the reported issue is no longer relevant P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js

Comments

@sethladd
Copy link
Contributor

Hi,

I hope this is a useful and real-life benchmark for the dart2js. I ported this to Dart and JavaScript, trying very hard to be line-by-line accurate. On my MBP, here are the times that I get:

(note: all times are averaged over 5 runs, each run loads, parses, and solves. This is the "cold start" test)

V8 + JS:
  parse the dictionary: 275ms
  solve: 0.75ms

V8 + dart2js:
  parse the dictionary: 700ms
  solve: 5ms

Dart VM + Dart + Dartium:
  parse the dictionary: 5000ms (?!?)
  solve: 1.5ms

Timings were derived with window.performance.now()

Dictionary has something like 17k words in it. The board is a classic 4x4 matrix.

You can find this code here:

Dart Solver: https://github.com/johnmccutchan/tilebasedwordsearch/blob/master/lib/solver.dart
Dart Trie: https://github.com/johnmccutchan/tilebasedwordsearch/blob/master/lib/trie.dart
Dart HTML file: https://github.com/johnmccutchan/tilebasedwordsearch/blob/master/web/solver/solver.html
Dart HTML script: https://github.com/johnmccutchan/tilebasedwordsearch/blob/master/web/solver/solver.dart

JS Solver: https://github.com/johnmccutchan/tilebasedwordsearch/blob/master/web/solver/solver.js
JS HTML file: https://github.com/johnmccutchan/tilebasedwordsearch/blob/master/web/solver/solver_js.html

To get the exact code as I tested it, get the tree at
https://github.com/johnmccutchan/tilebasedwordsearch/tree/f42057320f958e0932ed3c9403c8c6752aa24ce9

(interestingly, the VM takes much longer to parse the dictionary file, but I think that's a separate bug)

@sethladd
Copy link
Contributor Author

Forgot to add the compiled JS:

(using Dart Editor version 0.4.1_r19425)

https://github.com/johnmccutchan/tilebasedwordsearch/blob/f42057320f958e0932ed3c9403c8c6752aa24ce9/web/solver/solver.dart.js

@kasperl
Copy link

kasperl commented Mar 19, 2013

I suspect that this is a (very useful) benchmark of the Map class. We have no special handling of maps with int or string keys but they should be implementable using JS objects in a lot of cases.

@kasperl
Copy link

kasperl commented Mar 22, 2013

It would be great if you could try patching in the code in:

   https://codereview.chromium.org/12827018/

too see if the improved Map performance for non-linked hash maps matters.

@sethladd
Copy link
Contributor Author

sethladd commented Apr 7, 2013

Using Dart Editor version 0.1.2_r20838

I now see the following solve times:

V8 + Hand written JS: 0.5999999993946403

V8 + dart2js: 3.5500000085448846 ms

Dart VM: 1.6529999993508682 ms

V8 + dart2js is now approx 2.1X slower than the VM, and 5.9X slower than hand-written JS.


Changed the title to: "Boggle solver 2.1X slower on dart2js than Dart VM".

@sethladd
Copy link
Contributor Author

sethladd commented Apr 7, 2013

cc +iposva for the Dart VM / V8 timing differences


cc @iposva-google.

@kasperl
Copy link

kasperl commented Apr 22, 2013

Added this to the Later milestone.

@kasperl
Copy link

kasperl commented May 23, 2013

Added TriageForM5 label.

@kasperl
Copy link

kasperl commented May 28, 2013

Removed TriageForM5 label.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the Later milestone.
Added Oldschool-Milestone-Later label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-Later label.

@sethladd
Copy link
Contributor Author

This issue is really old... we'll have to measure again. There may not be a performance issue anymore.

@sigmundch
Copy link
Member

There is some work happening on this, though. Traditionally Dart maps are implemetned by dart2js using multiple JS objects, so there is a possibility that the issue still exists. @hterkelsen is looking into making the map implementation faster by using ES6 maps whenever the keys of the map use the identity-hashcode, which should include int and string keys.

@karlklose
Copy link
Contributor

@hterkelsen Is this still an issue?

@harryterkelsen
Copy link
Contributor

Yes, I have not enabled ES6 maps for Maps with identity-hashcode keys

@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed triaged labels Feb 29, 2016
@matanlurey matanlurey added the closed-obsolete Closed as the reported issue is no longer relevant label Jun 22, 2018
@matanlurey
Copy link
Contributor

I imagine this specific benchmark is not super important to us anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-obsolete Closed as the reported issue is no longer relevant P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js
Projects
None yet
Development

No branches or pull requests

8 participants
@sethladd @kevmoo @matanlurey @harryterkelsen @sigmundch @kasperl @karlklose and others