Skip to content

Commit

Permalink
Updating the tests for CF10
Browse files Browse the repository at this point in the history
  • Loading branch information
cybersonic committed Aug 7, 2012
1 parent 956c0d2 commit 0850d84
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 148 deletions.
165 changes: 28 additions & 137 deletions index.cfm
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<!DOCTYPE html>
<cfset showRailo = true>
<cfset showCF9 = false>
<cfset showCF10 = true>
<cfset showRailo = true>

<cfset CF9URL = "http://localhost:8080/cfusion9/mythbusters/tests/">
<cfset CF10URL = "http://localhost:8080/cfusion10/mythbusters/tests/">
<cfset CF10URL = "http://localhost:8500/mythbusters/tests/">
<cfset RAILOURL = "http://localhost:8080/railo4/mythbusters/tests/">
<cfparam name="URL.reload" default="false">
<cfset reload = "&amp;reload=#url.reload#">
Expand Down Expand Up @@ -121,23 +122,17 @@

<ul>
<li><abbr title="Your Milage May Vary">YMMV</abbr> (different configurations)
<li>Tried to use trusted cache so all templates are pre-compiled
<li>Already compiled in Railo as a .ra so compilation is out of the question
<li>I obviously work for a <a href="http://www.getrailo.com" title="Railo!">certain company</a>
<li>

<li>I obviously work for a <a href="http://www.getrailo.com" title="Railo!">certain company</a>
<li>Not a comparison of Railo Vs <abbr title="Adobe's ColdFusion">ACF</a> but testing each myth against each engine</li>
<li>

<cfif StructKeyExists(SERVER, "RAILO")>
Running on Railo <code><cfoutput>#SERVER.RAILO.VERSION#</cfoutput></code>
<cfelse>
Running on ColdFusion <code><cfoutput>#SERVER.COLDFUSION.VERSION#</cfoutput></code>
Running on ColdFusion <code><cfoutput>#SERVER.COLDFUSION.productversion#</cfoutput></code>
</cfif>



</li>
<!---
<li>Not a comparison of Railo Vs <abbr title="Adobe's ColdFusion">ACF</a> but testing each myth against each engine</li>
--->
</ul>

</p>
Expand Down Expand Up @@ -173,17 +168,7 @@
<section><cf_show template="loops/c.cfm"></section>
</article>

<article>
<h3>Results - Railo</h3>
<iframe src='/tests/index.cfm?test=loops&names=a,b,c<cfoutput>#reload#</cfoutput>'></iframe>
</article>

<cfif showCF10>
<article>
<h3>Results - CF10</h3>
<iframe src='<cfoutput>#CF10URL#</cfoutput>index.cfm?test=loops&names=a,b<cfoutput>#reload#</cfoutput>'></iframe>
</article>
</cfif>
<cf_results test="loops&names=a,b,c" reload="#reload#">


<cf_verdict result="busted" message="CFSCript isn't much faster, there are some TAG functions that are even faster!">
Expand All @@ -208,19 +193,7 @@
<section><cf_show template="inline_if/b.cfm"></section>
</article>

<article>
<h3>Results</h3>
<iframe src='http://mythbusters.local/tests/index.cfm?test=inline_if&names=a,b<cfoutput>#reload#</cfoutput>'></iframe>
</article>

<cfif showCF10>
<article>
<h3>Results - CF10</h3>
<iframe src='<cfoutput>#CF10URL#</cfoutput>index.cfm?test=inline_if&names=a,b<cfoutput>#reload#</cfoutput>'></iframe>
</article>
</cfif>


<cf_results test="inline_if&names=a,b" reload="#reload#">
<cf_verdict result="plausable" message="Such little difference in it, that we really can't decide">


Expand All @@ -244,17 +217,8 @@
<section><cf_show template="isdefined/c.cfm"></section>
</article>

<article>
<h3>Results</h3>
<iframe src='http://mythbusters.local/tests/index.cfm?loops=100000&test=isdefined&names=a,b,c<cfoutput>#reload#</cfoutput>'></iframe>
</article>
<cfif showCF10>
<article>
<h3>Results - CF10</h3>
<iframe src='<cfoutput>#CF10URL#</cfoutput>index.cfm?loops=100000&test=isdefined&names=a,b,c<cfoutput>#reload#</cfoutput>'></iframe>
</article>
</cfif>

<cf_results test="isdefined&names=a,b,c&loops=100000" reload="#reload#">

<article>
<h3>Code</h3>
<section><cf_show template="isdefined_2/a.cfm"></section>
Expand All @@ -264,20 +228,8 @@
<section><cf_show template="isdefined_2/c.cfm"></section>
</article>


<article>
<h3>Results</h3>
<iframe src='http://mythbusters.local/tests/index.cfm?loops=100000&test=isdefined_2&names=a,b,c<cfoutput>#reload#</cfoutput>'></iframe>
</article>
<cfif showCF10>
<article>
<h3>Results - CF10</h3>
<iframe src='<cfoutput>#CF10URL#</cfoutput>index.cfm?loops=10000&test=isdefined_2&names=a,b,c<cfoutput>#reload#</cfoutput>'></iframe>
</article>
</cfif>


<cf_verdict result="plausable" message="Such little difference in it, that we really can't decide">
<cf_results test="isdefined_2&names=a,b,c&loops=100000" reload="#reload#">
<cf_verdict result="plausable" message="Such little difference in it, that we really can't decide">


<!--- myth 4 --->
Expand All @@ -301,16 +253,7 @@
<section><cf_show template="output/b.cfm"></section>
</article>

<article>
<h3>Results</h3>
<iframe src='http://mythbusters.local/tests/index.cfm?loops=100&test=output&amp;names=a,b<cfoutput>#reload#</cfoutput>'></iframe>
</article>
<cfif showCF10>
<article>
<h3>Results - CF10</h3>
<iframe src='<cfoutput>#CF10URL#</cfoutput>index.cfm?loops=100&test=output&names=a,b<cfoutput>#reload#</cfoutput>'></iframe>
</article>
</cfif>
<cf_results test="output&names=a,b&loops=100" reload="#reload#">
<cf_verdict result="busted" message="Obviously outputting within a loop is much faster, than creating multiple instances of cfoutput">


Expand Down Expand Up @@ -345,19 +288,8 @@
<section><cf_show template="supersuper.cfc"></section>
</article>


<article>
<h3>Results</h3>
<iframe src='http://mythbusters.local/tests/index.cfm?test=duplicate&amp;names=a,b<cfoutput>#reload#</cfoutput>'></iframe>
</article>
<cfif showCF10>
<article>
<h3>Results - CF10</h3>
<iframe src='<cfoutput>#CF10URL#</cfoutput>index.cfm?test=duplicate&loops=1000&names=a,b<cfoutput>#reload#</cfoutput>'></iframe>
</article>
</cfif>

<cf_verdict result="confirmed" message='You can get a major boost by duplicating objects, even if they extend other objects'>
<cf_results test="duplicate&names=a,b" reload="#reload#">
<cf_verdict result="confirmed" message='You can get a major boost by duplicating objects, even if they extend other objects'>


<!--- myth 6 --->
Expand Down Expand Up @@ -387,20 +319,8 @@
</article>



<article>
<h3>Results</h3>
<iframe src='http://mythbusters.local/tests/index.cfm?loops=100&test=silence&amp;names=a,b,c,d&amp;RequestTimeout=300<cfoutput>#reload#</cfoutput>'></iframe>
</article>

<cfif showCF10>
<article>
<h3>Results - CF10</h3>
<iframe src='<cfoutput>#CF10URL#</cfoutput>index.cfm?loops=100&test=silence&names=a,b,c,d<cfoutput>#reload#</cfoutput>'></iframe>
</article>
</cfif>

<cf_verdict result="busted" message='Not much difference between using different trimming methodologies'>
<cf_results test="silence&names=a,b,c&loops=100&RequestTimeout=300" reload="#reload#">
<cf_verdict result="busted" message='Not much difference between using different trimming methodologies'>

<!--- myth 7--->
<article>
Expand All @@ -420,19 +340,10 @@
Vs.
<section><cf_show template="evaluate/c.cfm"></section>
</article>
<article>
<h3>Results</h3>
<iframe src='/tests/index.cfm?test=evaluate&amp;names=a,b,c<cfoutput>#reload#</cfoutput>'></iframe>
</article>

<cfif showCF10>
<article>
<h3>Results - CF10</h3>
<iframe src='<cfoutput>#CF10URL#</cfoutput>index.cfm?test=evaluate&names=a,b,c<cfoutput>#reload#</cfoutput>'></iframe>
</article>
</cfif>

<cf_verdict result="plausable" message='It is very slow in Railo, CF not so much'>

<cf_results test="evaluate&names=a,b,c" reload="#reload#">
<cf_verdict result="plausable" message='It is very slow in Railo, CF not so much'>


<!--- myth 8--->
Expand All @@ -458,16 +369,9 @@
Vs.
<section><cf_show template="invoke/c.cfm"></section>
</article>
<article>
<h3>Results</h3>
<iframe src='/tests/index.cfm?loops=10000&test=invoke&amp;names=a,b,c<cfoutput>#reload#</cfoutput>'></iframe>
</article>
<cfif showCF10>
<article>
<h3>Results - CF10</h3>
<iframe src='<cfoutput>#CF10URL#</cfoutput>index.cfm??loops=10000&test=invoke&names=a,b<cfoutput>#reload#</cfoutput>'></iframe>
</article>
</cfif>


<cf_results test="invoke&names=a,b&loops=10000" reload="#reload#">
<cf_verdict result="plausable" message='<strong>CFINVOKE</strong> creates new instances. No reason to use it with new syntax constructs like testObj["myMethod"]()'>

<!--- myth 9--->
Expand All @@ -487,14 +391,8 @@
Vs.
<section><cf_show template="compare/b.cfm"></section>
</article>
<article>
<h3>Results</h3>
<iframe src='/tests/index.cfm?test=compare&amp;names=a,b<cfoutput>#reload#</cfoutput>'></iframe>
</article>
<article>
<h3>Results - CF10</h3>
<iframe src='<cfoutput>#CF10URL#</cfoutput>index.cfm?test=compare&names=a,b<cfoutput>#reload#</cfoutput>'></iframe>
</article>

<cf_results test="compare&names=a,b&loops=10000" reload="#reload#">
<cf_verdict result="plausable" message="<strong>EQ</strong> seems to work pretty well">

<!--- myth 10--->
Expand All @@ -517,15 +415,8 @@
<section><cfoutput>#HTMLCodeFormat("<cfset sList = ArrayToList(aList)>")#</cfoutput></section>

</article>
<article>
<h3>Results</h3>
<iframe src='/tests/index.cfm?loops=1000&test=lists&amp;names=a,b<cfoutput>#reload#</cfoutput>'></iframe>
</article>
<article>
<h3>Results - CF10</h3>
<iframe src='<cfoutput>#CF10URL#</cfoutput>index.cfm?loops=1000&test=lists&names=a,b<cfoutput>#reload#</cfoutput>'></iframe>
</article>

<cf_results test="lists&names=a,b&loops=10000" reload="#reload#">
<cf_verdict result="busted" message="Lists are very slow! Use arrays instead">

<!--- myth 11--->
Expand Down
2 changes: 1 addition & 1 deletion results.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<cfparam name="CALLER.showCF9" default="false">
<cfparam name="CALLER.showRailo" default="false">
<cfparam name="attributes.test" default="">
<cfparam name="attributes.reload" defailt="false">
<cfparam name="attributes.reload" default="false">

<cfoutput>
<cfif CALLER.showRailo>
Expand Down
2 changes: 1 addition & 1 deletion show.cfm
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<cfscript>
WriteOutput(HTMLCodeFormat(FileRead("tests/#attributes.template#")));
WriteOutput(HTMLCodeFormat(FileRead(expandPath("tests/#attributes.template#"))));
</cfscript>
2 changes: 1 addition & 1 deletion tests/duplicate/a.cfm
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<cfset oTest = CreateObject("tests.test")>
<cfset oTest = CreateObject("mythbusters.tests.test")>
3 changes: 2 additions & 1 deletion tests/evaluate/c.cfm
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<cfset a = evaluate("ArrayLen([1,2,3])")>
<cfset myArray = [1,2,3]>
<cfset a = evaluate("ArrayLen(myArray)")>
6 changes: 5 additions & 1 deletion tests/index.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
<cfset testResult = convertToQuery(testResult)>
</cfif>


<cfchart chartwidth="700" chartheight="500" format="png">
<cfchartseries type="bar" >
<cfloop list="#url.names#" index="r">
Expand Down Expand Up @@ -99,7 +100,9 @@
SELECT MIN(result) AS minresult FROM arguments.results
WHERE name=<cfqueryparam cfsqltype="varchar" value="#arguments.name#">
</cfquery>

<cfif !IsNumeric(fastest.minresult)>
<cfreturn 0>
</cfif>
<cfreturn fastest.minresult>
</cffunction>

Expand All @@ -110,6 +113,7 @@
SELECT * FROM arguments.results
WHERE name= <cfqueryparam cfsqltype="varchar" value="#arguments.name#">
</cfquery>

<cfreturn range>
</cffunction>

Expand Down
2 changes: 1 addition & 1 deletion tests/invoke/a.cfm
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<cfset testObj = CreateObject("component", "tests.test")>
<cfset testObj = CreateObject("component", "mythbusters.tests.test")>
<cfset test1 = testObj.MyMethod()>
<cfset test2 = testObj.myMethod2()>
4 changes: 2 additions & 2 deletions tests/invoke/b.cfm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<cfinvoke component="tests.test" method="myMethod"
<cfinvoke component="mythbusters.tests.test" method="myMethod"
returnvariable="test1">
<cfinvoke component="tests.test" method="myMethod2"
<cfinvoke component="mythbusters.tests.test" method="myMethod2"
returnvariable="test2">
5 changes: 3 additions & 2 deletions tests/invoke/c.cfm
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<cfset testObj = CreateObject("component", "tests.test")>

<cfset testObj = CreateObject("component", "mythbusters.tests.test")>
<cfset test1 = testObj["MyMethod"]()>
<cfset test2 = testObj["myMethod2"]()>
<cfset test2 = testObj["myMethod2"]()>
2 changes: 1 addition & 1 deletion verdict.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<cfoutput>
<article>
<h3>Verdict</h3>
<img class='centered' style='width: 800px' src="/presentation/#attributes.result#.jpg">
<img class='centered' style='width: 800px' src="presentation/#attributes.result#.jpg">
<cfif len(attributes.message)>
<p>#attributes.message#</p>
</cfif>
Expand Down

0 comments on commit 0850d84

Please sign in to comment.