Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Shannon 148 posts 171 karma points
    Nov 12, 2010 @ 17:38
    Shannon
    0

    Performance hit using GetXmlDocumentByUrl for RSS Feed

    
    
    

    I am using the folling code to download, cache, and display an RSS Feed on my website

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:msxml="urn:schemas-microsoft-com:xslt"
        xmlns:umbraco.library="urn:umbraco.library"
        xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon"
        xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes"
        xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath"
        xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions"
        xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"
        xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
        exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets">

    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:param name="currentPage"/>

    <xsl:template match="/">
      <!-- start writing XSLT -->
      <xsl:variable name="MyFeed" select="umbraco.library:GetXmlDocumentByUrl('http://gizmodo.com/tag/top/index.xml')" />
      <ul>
        <xsl:for-each select="$MyFeed/rss/channel/item [position() &lt;= 3]">
          <li>
            <xsl:element name="a">
              <xsl:attribute name="rel">external</xsl:attribute>
              <xsl:attribute name="href">
              <xsl:value-of select="link" />
              </xsl:attribute>
              <xsl:value-of select="title" />
            </xsl:element>
          </li>
        </xsl:for-each>
      </ul>
    </xsl:template>
    </xsl:stylesheet>

     

    I am getting a huge performace hit at "After performing transformation". Can someone look at my code and see if there are any performance improvements that can be made?

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 12, 2010 @ 19:45
    Jan Skovgaard
    0

    How huge is your hit?

    At a first sight it looks ok to me...maybe some of the brighter XSLT wizards have a more thorough opinion on this. But it's interesting to get to know, how man seconds it takes to perform the tranformation.

    /Jan

  • Shannon 148 posts 171 karma points
    Nov 12, 2010 @ 19:48
    Shannon
    0

    Here is the debug:

    umbracoMacro    Macro loaded from cache (ID: 34, RSS Feed Mac Life)    0.7637827    0.000156
    renderMacro    Rendering started (macro: RSS Feed Mac Life, type: 1, cacheRate: 600)    0.7638197    0.000037
    umbracoMacro    Before adding extensions    0.7638985    0.000079
    umbracoXsltExtension    Extension added: urn:Exslt.ExsltCommon, ExsltCommon    0.765012    0.001114
    umbracoXsltExtension    Extension added: urn:Exslt.ExsltDatesAndTimes, ExsltDatesAndTimes    0.7650481    0.000036
    umbracoXsltExtension    Extension added: urn:Exslt.ExsltMath, ExsltMath    0.7650697    0.000022
    umbracoXsltExtension    Extension added: urn:Exslt.ExsltRegularExpressions, ExsltRegularExpressions    0.7650889    0.000019
    umbracoXsltExtension    Extension added: urn:Exslt.ExsltStrings, ExsltStrings    0.7651111    0.000022
    umbracoXsltExtension    Extension added: urn:Exslt.ExsltSets, ExsltSets    0.7651312    0.000020
    umbracoXsltExtension    Extension added: urn:tagsLib, library    0.7651502    0.000019
    umbracoXsltExtension    Extension added: urn:BlogLibrary, BlogLibrary    0.7651691    0.000019
    umbracoXsltExtension    Extension added: urn:UCommentLibrary, XSLTLibrary    0.7651882    0.000019
    umbracoXsltExtension    Extension added: urn:uForum, Xslt    0.7652072    0.000019
    umbracoXsltExtension    Extension added: urn:uForum.raw, RawXml    0.7652282    0.000021
    umbracoMacro    After adding extensions    0.7652467    0.000019
    umbracoMacro    Before performing transformation    0.765293    0.000046
    umbracoMacro    After performing transformation    1.2785128    0.513220

    Multiply this by 8 and my loadtime goes up to ~8 seconds

  • Shannon 148 posts 171 karma points
    Nov 15, 2010 @ 20:29
    Shannon
    0

    Anyone else have any feedback?

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Nov 15, 2010 @ 21:10
    Sebastiaan Janssen
    1

    Not much feedback, but it looks like the Gizmodo feed that you've put in there is very slow at the moment, so that might account for the slowdown.

    I have good experiences with the Feed Cache package that does this fetching of the feed asynchronously, which will prevent these slowdowns.

Please Sign in or register to post replies

Write your reply to:

Draft