-
Notifications
You must be signed in to change notification settings - Fork 34
Perf degradation due to calls to window.getComputedStyle in attached #68
Comments
getComputedStyle added for the first render +60ms. May be there is another way to identify LTR/RTL. For example providing as property and setting by default to false or calculating in setTimeout. Why this issue is still opened? |
This issue causes ~20+% rendering performance degradation in the real app, please see: All reds you see - forced reflow @ iron-fit-behavior.html:262 |
Chiming in a little late - but we have the same issue in our app. We are including lots of elements which use iron-fit-behavior and each one is performing this calculation. Can you do this as a scoped variable in iron-fit-behavior so it is calculated once upon load. |
Same here. Performance degradation because of many elements triggering the calculation. |
Maybe a decent solution would be to add a new feature, along the lines of what @stat92 mentioned. Add an Not sure how easy it would be to get some Polymer people to have a look at it but might be worth issuing a PR and tagging some of them |
In attached we remember if the element is RTL or not:
this._isRTL = window.getComputedStyle(this).direction == 'rtl';
Even though this is designed as too avoid having to make recurrent call to getComputedStyle attached can be called again when moving the element around in the dom, performing an unneeded calculation/layout.
In our case the performance hit actually shows when moving an item around having 40 subitems which all get "attached".
The text was updated successfully, but these errors were encountered: