Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-1537

Improve js processing time for pages with huge number of zones

    XMLWordPrintableJSON

Details

    Description

      When creating a new page with a huge number of zones we are initializing all them in javascript calling Tapestry.ZoneManager.initialize. This is not affecting modern browser, but for some old browser like internet explorer 6 or 7, this method can take a long time to be executed.

      In order to prevent this overhead in the javascript load in the user browser, we can lazily create the zoneManager object when it is needed. For doing this we should only create the js zone object when there is some special parameter for creating it. The only time we need to create the zone in load time, is when we have some special setup for creating the zone.

      The zone can be created when calling findZoneManagerForZone. If it fails to find the zone, we can try to create it, and only if it fails we will fire the error message.

      Once the zone has been lazily created, findZoneManagerForZone it will find the zone following the normal behaviour.

          1. Eclipse Workspace Patch 1.0
            #P tapestry-core
            Index: src/main/resources/org/apache/tapestry5/tapestry.js
            ===================================================================
          • src/main/resources/org/apache/tapestry5/tapestry.js (revision 1129658)
            +++ src/main/resources/org/apache/tapestry5/tapestry.js (working copy)
            @@ -492,6 +492,9 @@
            var manager = $T(element).zoneManager;

      if (!manager) {
      + var mgr = new Tapestry.ZoneManager(

      {"element":zoneElement}

      );
      + if (mgr)
      + return mgr;
      Tapestry.error(Tapestry.Messages.noZoneManager, element);
      return null;
      }
      @@ -1233,7 +1236,8 @@
      },

      zone : function(spec)

      { - new Tapestry.ZoneManager(spec); + if (spec.show || spec.parameters || (spec.update && spec.update != 'show') ) + new Tapestry.ZoneManager(spec); }

      ,

      formFragment : function(spec) {

      Attachments

        1. tapestry-zone-improvement.txt
          0.8 kB
          Pedro Ayala

        Activity

          People

            Unassigned Unassigned
            pjayala Pedro Ayala
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: