Learning ColdFusion 8: CFThread Part II - Parallel Threads

<!---
	Build the base URL for the results. This will
	include everything but the start index. We are
	going to be screen-scraping Google for some
	search results.
--->
<cfset strBaseURL = (
	"http://www.google.com/search?" &
	"q=Vin+Diesel" &
	"&num=100" &
	"&start="
	) />
 
 
<!---
	Method One: Traditional Syncronous CFHttp calls.
	This methodology requires that ColdFusion run
	each CFHttp on its own and then wait for it to
	finish before firing off the next one.
--->
 
 
<!--- Get the starting time. --->
<cfset intStartTime = GetTickCount() />
 
<!---
	Let's get the first 1000 results for Vin Diesel.
	In order to do this, we are going to grab 10 sets
	of 100 results.
--->
<cfloop
	index="intGet"
	from="1"
	to="10"
	step="1">
 
	<cfhttp
		method="GET"
		url="#strBaseURL##((intGet - 1) * 100)#"
		useragent="#CGI.http_user_agent#"
		result="objGet#intGet#"
		/>
 
</cfloop>
 
 
<!--- Output retrieval times. --->
<p>
	We Got 1000 Results in
	#NumberFormat(
		((GetTickCount() - intStartTime) / 1000),
		",.00"
		)#
	seconds using standard CFHttp
</p>

For Cut-and-Paste