开发者

Slowness in Orbeon page rendering when showing a group with a large number of fields

I am working on Orbeon forms and i have a performance related issue as explained below.

I have a form where I have five fields initially. On the fifth 开发者_Python百科dropdown field, if I select "Yes", because of xforms:group it shows a block of fields (the block has around 40 fields). Since the block is in the repeated section, I can add/delete as many blocks as I can.

Now, if I add say 10 blocks and when I toggle the fifth dropdown field from any value to "Yes", it takes more than 2 seconds to display all the blocks.

I am using Orbeon Forms 3.8 and Tomcat 6 on Windows XP desktop with 2GB RAM.

Please let me know what happens when "Yes" is selected (meaning conditional display when xforms:group is true) which is taking more time to display.

<xforms:group ref=".[instance('form-attributes')/flag='yes']" >
    //code for the controls here
</xforms:group>


If you are using code that looks like:

<xforms:group ref=".[condition]">
    <!-- Large number of fields -->
</xforms:group>
  1. When condition is false, the fields inside the group are non-relevant. The XForms engine doesn't compute their value, read-only status, validity, label, hint, help, alert, etc.
  2. When condition becomes true, the content of the group become relevant, and the XForms engine evaluates all the controls inside the group.
  3. The browser needs to apply all those changes to the DOM.

Typically, step #2 is much faster than #3, especially with IE7. To avoid the numerous updates on step #3, another way to write this code is:

<xhtml:div class="{if (condition) then '' else 'xforms-disabled'}">
    <!-- Large number of fields -->
</xhtml:div>

With this, the fields inside the div will always be relevant:

  • The upside is that when condition becomes true, all the browser might need to do is to flip that class on the div. It won't necessarily need to update all the controls inside, unless of course their value has also changed.
  • The downside is that while condition is false, the XForms engine, on the server, needs to keep all the controls inside the div up-to-date.

But more often than not, especially when you're seeing IE7 slowness, the performance you gain on the client far outweighs the increased processing that might be needed on the server.



I found this link that seems to suggest span tag instead of div tag, though the original post was for Code crash, the suggested work around gave a small performance improvement in my form when I tested it in IE. Hope this code will give you some benefit.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜