This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Jul 14, 2013, 9:58 PM
453 Posts

performance of rendered vs display:none

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 9.0
  • Role: Developer
  • Tags: rendered
  • Replies: 3

I am working with a number of panels on an XPage. I don't need all the panels to display at the same time and am using a viewScope to display or hide the panels. I understand that the rendered property will only load the stack with the information for the rendered panels so the packet passed back and forth to the server will be smaller. In some testing that I did I could see no performance differences between setting the rendered true/false and setting style ""/"display:none". The "display:none" has an advantage as you can perform a getComponent vs having the get the document then the value from it if the control is on a non-displayed panel.

Could also set rendered false and loaded true and I don't see that as an advantage over display:none. The problem that I encountered with this method was that default values did not seem to get loaded, but they are if display:none is used.

So I can see pluses and minuses with each method, has anyone done any real life testing from a performance perspective? I can see a distinct advantage to the display:none if you need access to the controls on 'hidden' panels.

Jul 15, 2013, 10:08 AM
298 Posts
See the XPages performance masterclass
A good understanding of the XPages/JSF lifecycle can be had by watching these videos.
http://tonymcguckin.wordpress.com/2013/04/22/xpages-masterclass-series-1/

You will see that all the rendered properties get calculated multiple times each time the XPage is submitted.  That is where partial execution/partial refresh can help a lot.  Also Paul Withers has written about dataContexts and how they help performance in this case.  Loaded on the other hand just happens once when the page loads.

Howard
Jul 15, 2013, 12:24 PM
17 Posts
rendered

Hi, I would bet that "rendered" has the better performance, reasons:

- function calls on components which are within a component which is not rendered are not executed
- less data transfered between client / server (display:none is considered by the browser, so the whole data is transfered to the client)..

depends where you use it.. e.g. if you have quite a big part of a form (with comboboxes with lookups, etc.) whose display you want to compute, i would very recommend "rendered".. 

On the other side you can have very improved performance if you want to toggle display/none display state of a part: so in this case you work with display:none or display:block (client side only)..

Jul 15, 2013, 6:22 PM
586 Posts
My thoughts

Bill,

By definition controlling rendered will perform better then display:none because XPages will ignore non rendered code at various phases of the lifecycle.  display:non means xpages will still be doing all the work of those panels - they just don't show up.

My understanding on loaded vs. rendered is that loaded is only evaluated during page load.  Not refresh.  So if you set loaded to false - it's not coming back until you do a full refresh of the page.  I could be wrong though.

It depends on what you need functionality.  If you must have access to those panels then you probable can't use rendered.  Because basically if it's not being rendered then it doesn't exist.  So you can't refresh or otherwise interact with a non rendered component.

If you need access to "hidden panels" then you might want to think about what you're doing.  Is it hidden for convenience ?  or hidden as a means of security.  And we all know that "Security through obscurity is not security".   :-)

Possibly you're business logic shouldn't be in the panel but be in something like a managed bean.  Then you could have access to all the data fields while not rendering specific panels.

Just a thought.


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal