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
Comments
Forgot to add the compiled JS: (using Dart Editor version 0.4.1_r19425) |
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. |
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. |
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". |
cc +iposva for the Dart VM / V8 timing differences cc @iposva-google. |
Added this to the Later milestone. |
Added TriageForM5 label. |
Removed TriageForM5 label. |
Removed this from the Later milestone. |
Removed Oldschool-Milestone-Later label. |
This issue is really old... we'll have to measure again. There may not be a performance issue anymore. |
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. |
@hterkelsen Is this still an issue? |
Yes, I have not enabled ES6 maps for Maps with identity-hashcode keys |
I imagine this specific benchmark is not super important to us anymore |
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)
The text was updated successfully, but these errors were encountered: