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

Numerical stability regression in dartbox2d compiled to JS #4075

Closed
DartBot opened this issue Jul 12, 2012 · 9 comments
Closed

Numerical stability regression in dartbox2d compiled to JS #4075

DartBot opened this issue Jul 12, 2012 · 9 comments
Assignees
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-performance Issue relates to performance or code size web-dart2js

Comments

@DartBot
Copy link

DartBot commented Jul 12, 2012

This issue was originally filed by domi...@google.com


The last dart2js I tried was synced around May 25th. I synced the new version today, Jul 12th.

As of now, compiling the dartbox2d demos with dart2js exposes some obvious numerical instabilities that didn't exist previously. I've attached an example .js file as before-stable.js and after-unstable.js.

These changes make dartbox2d unusable outside of the Dart VM.

Running the same demos in Dartium shows no instability.


Attachments:
before-stable.js (460.86 KB)
after-unstable.js (745.58 KB)

@sethladd
Copy link
Contributor

Added Triaged label.

@DartBot
Copy link
Author

DartBot commented Jul 12, 2012

This comment was originally written by Ruper...@gmail.com


The regression was introduced into dart2js between versions 8942 and 9258.
(I'd planned to report since I've been developing DartBox2D and updating Dart weekly but couldn't determine sufficiently minimal test-case. The commit I'm hoping to push for DartBox2D includes a minimal DartBox2D testcase but this still drags-in lots of code!)
HTH, R.

@floitschG
Copy link
Contributor

Set owner to @floitschG.
Added Started label.

@floitschG
Copy link
Contributor

Tracked it down to commit 9019.
Investigating what exactly went wrong now.

@floitschG
Copy link
Contributor

@floitschG
Copy link
Contributor

Fixed in r9695.

The bug was triggered by a loop that didn't have any back-edge: http://code.google.com/p/dartbox2d/source/browse/lib/dynamics/contacts/ContactSolver.dart#­374

This should be correctly handled now, but if the loop is not needed it should maybe be removed. Dart2js does not yet detect that the loop is not needed.


Added Fixed label.

@DartBot
Copy link
Author

DartBot commented Jul 17, 2012

This comment was originally written by domi...@google.com


Thank you so much for chasing this down.

You're right that the loop is not necessary, however it is a valid code construct to avoid complex nested if-statements. As it happens, I'd prefer the nested conditionals but dart2js should still be able to handle the code.

Is there already an open issue for this?

@floitschG
Copy link
Contributor

It does handle it correctly now. Just not as optimized as without the loop.
For example it will assume that the code inside the loop is executed more than once and will therefore try to optimize more optimistically for the body.

@DartBot
Copy link
Author

DartBot commented Jul 18, 2012

This comment was originally written by Ruper...@gmail.com


Confirmed this fixes the bug in dartbox2d. Thanks!

@DartBot DartBot added Type-Defect P1 A high priority bug; for example, a single project is unusable or has many test failures web-dart2js type-performance Issue relates to performance or code size labels Jul 18, 2012
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-performance Issue relates to performance or code size web-dart2js
Projects
None yet
Development

No branches or pull requests

3 participants