Ive got a performance issue, when trying to select the newest 20 nodes from a news list of more than 5000 items.
What is best practice when selecting from a large amount of items?
My tree is as follows:
NewsList
--Year
----Month
------NewsItem
The best result so far, has been a clean select that is select="$newsList/Year/Month/NewsItem" with a sort select umbraco.library:FormatDateTime(@createDate, 'yyyyMMddhhmm') and then a position()<21
But it gives me a renderingtime of 0.7 seconds, which is far too much for my serveradmin to appeciate.
One thing you should do is to skip the library function - @createDate IS already sortable as it is, so a plain <xsl:sort select="@createDate" /> will do just fine. That might shave off a point or two...?
Since you're already using year/month folders, maybe selecting only nodes from current and previous year would be sufficient already? That should bring it down quite a pair of notches too, I'd say.
Performance issue +5000 nodes
Hi there
Ive got a performance issue, when trying to select the newest 20 nodes from a news list of more than 5000 items.
What is best practice when selecting from a large amount of items?
My tree is as follows:
NewsList
--Year
----Month
------NewsItem
The best result so far, has been a clean select that is select="$newsList/Year/Month/NewsItem" with a sort select umbraco.library:FormatDateTime(@createDate, 'yyyyMMddhhmm') and then a position()<21
But it gives me a renderingtime of 0.7 seconds, which is far too much for my serveradmin to appeciate.
Thanks for any help given :)
/Kim
Hi Kim
What does the full xslt code look like right now?
/Jan
Hi Kim,
One thing you should do is to skip the library function - @createDate IS already sortable as it is, so a plain <xsl:sort select="@createDate" /> will do just fine. That might shave off a point or two...?
Since you're already using year/month folders, maybe selecting only nodes from current and previous year would be sufficient already? That should bring it down quite a pair of notches too, I'd say.
/Chriztian
Hi there fellow danes :)
My mood has just gone up by 100%
The createDate solution gave me next to nothing, but the other one is a hole other story :)
The rendering time just went from 0.7 sec to 0.02 by selecting from this year only.
I tried to render using news from 2011, and the rendering time were 0.05 secs.
But i think ill change it up a bit, and select from the last 2 months, so i dont run in to any problems in the beginning of 2013.
<xsl:variable name="currentYear" select="umbraco.library:FormatDateTime(umbraco.library:CurrentDate(), 'yyyy')"/>
<xsl:for-each select="$newsList/Year[@nodeName=$currentYear]/Month/NewsItem">
<xsl:sort select="@createDate" order="descending"/>
<xsl:if test="position()<21">
Blah..
</xsl:if>
</xsl:for-each>
Jan, you probably know the project.
Kim Sørensen has been working on it for a while now :)
Hi Kim
hmm, if you by "Kim Sørensen" actually mean "Kim Andersen", then yes :)
/Jan
Weeeell, 50% right :)
is working on a reply...