Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will specifying dom elements' height/width make them render faster?

In "upgrading" from ExtJS3 to ExtJS4, one specific instance of our prior code not working any more is when using renderTo to render a component to a specific div in the page, but then updating the innerHTML later when a callback has completed. I've looked at the generated dom element, and in ExtJS3 no height was specified, but in ExtJS4 an initial height was calculated and added as a style attribute to the div tag.

My question is, will specifying the height on a DOM element make rendering faster? (ExtJS4 is supposed to be a performance upgrade after all) Will it differ from browser to browser? Is there any benchmarking data already available?

By the way, because in ExtJS4 an initial height was calculated, even after the call to update() (which updates the innerHTML), the component would not render as desired as the calculated height was no longer sufficient. The solution was a subsequent call to the new doComponentLayout method (as opposed to merely doLayout)

like image 734
Dexygen Avatar asked Aug 20 '26 04:08

Dexygen


2 Answers

Theoretically, it should be faster if you specify a width because then the framework doesn't need to calculate the width.

Practically, you need to follow the code of the specific component that you are resizing and figure out how much effort indeed went to calculating the sizes.

like image 170
Chao Avatar answered Aug 21 '26 17:08

Chao


As Chao Suggested, is theoretically faster.

But you have to consider in web developing, the screen size of the user may not be as big or small as yours, wich means it may see a little strange in different screen resolutions

like image 35
Carlos Valenzuela Avatar answered Aug 21 '26 18:08

Carlos Valenzuela



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!