threeDart / three.dart

Dart port of three.js
http://threedart.github.com/three.dart/
MIT License
387 stars 100 forks source link

Severe performance degradation relative to three.js #142

Open DanielJoyce opened 10 years ago

DanielJoyce commented 10 years ago

The ported demos in three.dart are a lot slower compared to three.js, with much more latency, stuttering, and lower framerate

DanielJoyce commented 10 years ago

Ugh, I should qualify this a bit more. Seems some demos are broken, some work perfectly fine. I have noticed that recently, with dual screen on linux, webgl slows down when chrome is full sized on one screen. Shrinking the window slightly fixes it, and for the demos that don't appear to be broken, three.dart is very fast.

DanielJoyce commented 10 years ago

I've notices the same behavior with three.js on dual monitor setups with chrome in Linux.

ghost commented 10 years ago

The problem, at least from what I can tell, is ONLY a problem with JavaScript. I assume you are using the compiled code from Dart to JavaScript on the demos instead of running them through Dart because you said Chrome not Dartium.

For example, after profiling each section of code, the Dart code takes 5x more time for: multiplying matrices, setting matrix3f uniforms, and for setting matrix4f uniforms.

I'll get back to you when I test the code in Dartium, but until then, know that Dart2JS isn't a fair comparison.

sethladd commented 10 years ago

This might be a good bug for dart2js: if you can create a small repro Dart program that runs very slow when compiled to JS, please add it to a new issue here: dartbug.com/new

beatgammit commented 10 years ago

Here's what I've experienced:

The above is only from memory after playing with it for a few minutes, so I could have my data mixed up.

My program is a 50x50 hex grid with two basic shaders. It's currently ~200 SLOC, but I think I can reduce it a bit. I'll try to post a live demo so both the three.dart team and dart2js team can take a look.

ghost commented 10 years ago

Do you happen to know what version of chromium dartium is based on? Last time I saw I believe chromium was version 39 and dartium was 37. Do you know if the program is bottlenecked on the CPU or the GPU?