Why does DART make my site SOOOOO slow?

我的梦境 提交于 2019-12-13 17:54:19

问题


collegues!

I have been working in this website ( www.2winbet.gr ).

This week added a login interface from the website that was build as a small plugin in Dart using polymer.

It all "works", and I am pretty happy with the speed I managed to build this component in Dart... BUT.... the site became HYPER slow after I added it!!...

If I remove it, the site is super fast again...

My dart code is so small and simple... I can really not understand where the issue is...

Could you please point me out what have I done wrong here? I can not believe this is the best Dart can do when added as a small component to a Wordpress site that has a few animations on it.

Thanks in forward


回答1:


I have asked John Messerly (who is working on Dart's Polymer):

This looks like it's Polymer's fault. Polymer depends on shadow DOM, but there seems to be no good way polyfill that functionality, without wrapping every node in the DOM.

The polyfill should be as fast as it possibly can get, but, due to the wrapping, there is some unavoidable cost. The actual overhead depends on the size of DOM and ratio of DOM operations to other app code. Possibly there are some particularly slow areas that haven't been hit yet, though. Especially event dispatch seems to be tricky to implement.

It would probably be interesting to get more data. (Feel free to reach out to us on the bug-tracker).

You would probably get the optimal performance on a native implementation. Chrome 35 is shipping it. Firefox is experimenting with an implementation.

You could also try to refactor your app so that the shadow DOM/Polymer.dart part is contained in an iFrame. This way it wouldn't affect other things on the page.



来源:https://stackoverflow.com/questions/23277533/why-does-dart-make-my-site-sooooo-slow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!