tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pedro Ayala (JIRA)" <j...@apache.org>
Subject [jira] [Created] (TAP5-1537) Improve js processing time for pages with huge number of zones
Date Tue, 31 May 2011 13:16:47 GMT
Improve js processing time for pages with huge number of zones

                 Key: TAP5-1537
                 URL: https://issues.apache.org/jira/browse/TAP5-1537
             Project: Tapestry 5
          Issue Type: Improvement
          Components: tapestry-core
    Affects Versions: 5.2.5, 5.3.0
            Reporter: Pedro Ayala
         Attachments: tapestry-zone-improvement.txt

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.

### 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) {

This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message