Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cfhttp and xml pages are slooooooow

Status
Not open for further replies.

brantGuy

Programmer
Feb 12, 2007
59
CA
I have an xml news feed on my site but on the page that the xml news comes up on is slow. Is this a result of the xml parsing, the xml supplier...what can I do....

Code:
<cfhttp url="MY XML FEED" method="GET" resolveurl="No" ></cfhttp>
<cfset world=XMLParse(cfhttp.FileContent)>

<cfoutput>
<cfloop index="x" from="1" to="10">
<img src="images/documentWhite.gif" width="16" height="11" />
<a href="readNews.cfm?category=Local Sports&loop=#x#"><span class=cDef onMouseOver="this.className='cRoll'" onMouseOut="this.className='cDef'">#world.rss.channel.item[x].title.xmlText#</span></a>
<br />
</cfloop>
</cfoutput>
 
the slowest part of this is going to be the cfhttp for sure. do a couple of tests by wrapping a gettickcount around the cfhttp to see how long that takes to execute, like this:

Code:
<cfset start = getTicketCount()>
<cfhttp url="MY XML FEED" method="GET" resolveurl="No" /> 
<cfset end = getTicketCount()>

<cfset totalTime = end-start>
<cfoutput>
  #totaltime#
</cfoutput>

at the end of the day the time that this takes is going to be dependant on the size of the xml doc that is returned from your feed source. you might be better caching the xml doc locally into a app variable or finding another source for the content

Hope this helps!

Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top