Tapestry 5
  1. Tapestry 5
  2. TAP5-1538

Optimize client-side URL rebuilding in IE 7

    Details

      Description

      While loading the tapestry javascript, we execute the "contains" function for every script and css files in the page. The function tries to find if we already have one asset in the list of script.

      Firefox and Chrome already contains the complete URL, but IE needs to call rebuildURL to get it. This results in calling the function hundred of times so any little optimization of it saves some javascript loading time.

      The most expensive operation is the one for retrieving the window.location url and adding it to the path parameter. In order to improve it, we can save the basic build url in a local variable and just add the path to it.

          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 1129681)
            +++ src/main/resources/org/apache/tapestry5/tapestry.js (working copy)
            @@ -522,8 +522,12 @@
            return path;
            }
      • var l = window.location;
      • return l.protocol + "//" + l.host + path;
        + if (!Tapestry.buildUrl) { + var l = window.location; + Tapestry.buildUrl = l.protocol + "//" + l.host; + }

        +
        + return Tapestry.buildUrl + path;
        },

      stripToLastSlash : function(URL) {

        Activity

        Hide
        Howard M. Lewis Ship added a comment -

        If we release a 5.2.6, we should back port this.

        Show
        Howard M. Lewis Ship added a comment - If we release a 5.2.6, we should back port this.
        Hide
        Hudson added a comment -

        Integrated in tapestry-trunk-freestyle #358 (See https://builds.apache.org/hudson/job/tapestry-trunk-freestyle/358/)
        TAP5-1538: Optimize client-side URL rebuilding in IE 7

        hlship : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1130674
        Files :

        • /tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
        Show
        Hudson added a comment - Integrated in tapestry-trunk-freestyle #358 (See https://builds.apache.org/hudson/job/tapestry-trunk-freestyle/358/ ) TAP5-1538 : Optimize client-side URL rebuilding in IE 7 hlship : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1130674 Files : /tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
        Hide
        Howard M. Lewis Ship added a comment -

        For backporting

        Show
        Howard M. Lewis Ship added a comment - For backporting

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Pedro Ayala
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development