≪ ≪ coldfusion server ServiceFactory CFでミリ秒単位の計測 ≫ ≫
ColdFusionMxで下記のテストソースで実験した
結果↓CFSCRIPTの方が1.4倍位速いかも。。
Ix CfTagTime(ms) CfScriptTime(ms)
1 1859 1360
2 1843 1313
3 1844 1296
4 1860 1312
5 1844 1313
6 1875 1296
7 1844 1313
8 1859 1313
9 1843 1328
10 1860 1312
Sum 18531 13156
↓↓↓↓↓ テスト用ソース ↓↓↓↓↓

<!--- ループ回数 --->
<cfset Variables.nTstMax = 10>
<cfset Variables.nMax = 100000>
<!--- 結果格納構造体 --->
<cfset Variables.aRst = ArrayNew(1)>
<cfloop index="Variables.nTstCnt" from="1" to="#Variables.nTstMax#">
<!--- 初期化 --->
<cfset Variables.aRst[Variables.nTstCnt] = StructNew()>
<!--- CFLOOPタイム計測 --->
<cfset Variables.Time = GetTickCount()>
<cfloop index="Variables.nIx" from="1" to="#Variables.nMax#">
<cfswitch expression="#(Variables.nIx MOD 5)#">
<cfcase value="0"><cfset Variables.Dummy=0></cfcase>
<cfcase value="1"><cfset Variables.Dummy=1></cfcase>
<cfcase value="2"><cfset Variables.Dummy=2></cfcase>
<cfcase value="3"><cfset Variables.Dummy=3></cfcase>
<cfcase value="4"><cfset Variables.Dummy=4></cfcase>
<cfdefaultcase><cfset Variables.Dummy=""></cfdefaultcase>
</cfswitch>
<cfif True>
<cfset Variables.Dummy=True>
<cfelse>
<cfset Variables.Dummy=False>
</cfif>
</cfloop>
<cfset Variables.aRst[Variables.nTstCnt].CfTagTime = GetTickCount()-Variables.Time>
<!--- CFSCRIPTタイム計測 --->
<cfset Variables.Time = GetTickCount()>
<cfscript>
FOR (Arguments.nIx=1;Variables.nMax+1 gt Arguments.nIx;Arguments.nIx=Arguments.nIx+1){
SWITCH(Variables.nIx MOD 5) {
CASE "0":{Variables.Dummy=0;break;};
CASE "1": {Variables.Dummy=1;break;};
CASE "2": {Variables.Dummy=2;break;};
CASE "3": {Variables.Dummy=3;break;};
CASE "4": {Variables.Dummy=4;break;};
DEFAULT : {Variables.Dummy="";break;};
};
};
IF (True){
Variables.Dummy=True;
}ELSE{
Variables.Dummy=False;
};
</cfscript>
<cfset Variables.aRst[Variables.nTstCnt].CfScrTime = GetTickCount()-Variables.Time>
</cfloop>
<cfoutput>
<table border="1">
<tr>
<th>Ix</th>
<th>CfTagTime(ms)</th>
<th>CfScriptTime(ms)</th>
</tr>
<cfset Variables.CfTagTimeSum = 0>
<cfset Variables.CfScrTimeSum = 0>
<cfloop index="Variables.nIx" from="1" to="#ArrayLen(Variables.aRst)#">
<tr>
<td>#Variables.nIx#</td>
<td>#Variables.aRst[Variables.nIx].CfTagTime#</td>
<td>#Variables.aRst[Variables.nIx].CfScrTime#</td>
</tr>
<cfset Variables.CfTagTimeSum = Variables.CfTagTimeSum + Variables.aRst[Variables.nIx].CfTagTime>
<cfset Variables.CfScrTimeSum = Variables.CfScrTimeSum + Variables.aRst[Variables.nIx].CfScrTime>
</cfloop>
<tr>
<th>Sum</th>
<th>#Variables.CfTagTimeSum#</th>
<th>#Variables.CfScrTimeSum#</th>
</tr>
</table>
</cfoutput>
↑↑↑↑↑ テスト用ソース ↑↑↑↑↑

≪ ≪ coldfusion server ServiceFactory CFでミリ秒単位の計測 ≫ ≫

関連記事

Google Ads

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>