<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style>
<!--
@font-face
        {font-family:Calibri}
@font-face
        {font-family:Tahoma}
@font-face
        {font-family:Consolas}
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif"}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif"}
span.EmailStyle17
        {font-family:"Arial","sans-serif";
        color:windowtext}
span.BalloonTextChar
        {font-family:"Tahoma","sans-serif"}
.MsoChpDefault
        {font-family:"Calibri","sans-serif"}
@page WordSection1
        {margin:72.0pt 72.0pt 72.0pt 72.0pt}
div.WordSection1
        {}
-->
</style>
</head>
<body lang="EN-AU" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">Hi folks,</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I&#8217;ve just started going through loops and leading into multi-dimensional arrays. Last night the boys did the first 2 exercises of Marks old &#8220;Arrays and Loops Exercises&#8221;.
 In the increasing stars program, he managed to do it in 2 less lines of code and so I was curious as to which was physically faster. I put a timer class into the code to test it, and his was dramatically faster. 0.415 sec versus 0.084 sec</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">Anyone out there able to explain why?</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">Cheers</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">Damien</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">&nbsp;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;
<span style="color:blue">Sub</span> Main()</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:green">'My version</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:blue">Dim</span> firstTick <span style="color:blue">As</span> <span style="color:#2B91AF">
TickTimer</span> = <span style="color:blue">New</span> <span style="color:#2B91AF">
TickTimer</span>()</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:blue">For</span> counter <span style="color:blue">As</span> <span style="color:blue">
Integer</span> = 1 <span style="color:blue">To</span> 100</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:blue">For</span> InnerCounter = 1 <span style="color:blue">To</span> counter</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:#2B91AF">Console</span>.Write(<span style="color:#A31515">&quot;*&quot;</span>)</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:blue">Next</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:#2B91AF">Console</span>.WriteLine()</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:blue">Next</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:green">'Adems version</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:blue">Dim</span> secondTick <span style="color:blue">As</span>
<span style="color:#2B91AF">TickTimer</span> = <span style="color:blue">New</span>
<span style="color:#2B91AF">TickTimer</span>()</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:blue">Dim</span> star <span style="color:blue">As</span> <span style="color:blue">
String</span> = <span style="color:#A31515">&quot;*&quot;</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:blue">For</span> counter2 <span style="color:blue">As</span> <span style="color:blue">
Integer</span> = 1 <span style="color:blue">To</span> 100</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:#2B91AF">Console</span>.WriteLine(star)</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; star &#43;=
<span style="color:#A31515">&quot;*&quot;</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:blue">Next</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:green">'display timing</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:#2B91AF">Console</span>.WriteLine(firstTick.DeltaSeconds(<span style="color:#A31515">&quot;Mine&quot;</span>))</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:#2B91AF">Console</span>.WriteLine(secondTick.DeltaSeconds(<span style="color:#A31515">&quot;Adems&quot;</span>))</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:green">'wait til key pressed</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:#2B91AF">Console</span>.ReadKey()</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;
<span style="color:blue">End</span> <span style="color:blue">Sub</span></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">&nbsp;</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">&nbsp;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;
<span style="color:blue">Public</span> <span style="color:blue">Class</span> <span style="color:#2B91AF">
TickTimer</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:blue">Public</span> currentTicks <span style="color:blue">As</span>
<span style="color:blue">Long</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:blue">Public</span> lastTicks <span style="color:blue">As</span>
<span style="color:blue">Long</span> = System.<span style="color:#2B91AF">DateTime</span>.Now.Ticks</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:blue">Public</span> retVal <span style="color:blue">As</span> <span style="color:blue">
String</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:green">''' </span><span style="color:gray">&lt;summary&gt;</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:green">''' Calculates the seconds it took since the class was instantiated until this method</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:green">''' is first invoked and for subsequent calls since the previous time the method was called</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:green">''' </span><span style="color:gray">&lt;/summary&gt;</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:green">''' </span><span style="color:gray">&lt;param name=&quot;message&quot;&gt;</span><span style="color:green">Message (e.g. &quot;The last query took &quot;)</span><span style="color:gray">&lt;/param&gt;</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:green">''' </span><span style="color:gray">&lt;returns&gt;</span><span style="color:green">The passed string followed by the seconds: &quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The last query took,&nbsp;&nbsp;&nbsp;&nbsp; 0.3456&quot;</span><span style="color:gray">&lt;/returns&gt;</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:green">''' </span><span style="color:gray">&lt;remarks&gt;</span><span style="color:green">To see how long it takes a method to execute instantiate this class at its</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:green">''' very begining and call this method just before it returns; Log the result with&nbsp;&nbsp;&nbsp;&nbsp; Debug.Writeln or something similar</span><span style="color:gray">&lt;/remarks&gt;</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:blue">Public</span> <span style="color:blue">Function</span> DeltaSeconds(<span style="color:blue">ByVal</span> message
<span style="color:blue">As</span> <span style="color:blue">String</span>) <span style="color:blue">
As</span> <span style="color:blue">String</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; currentTicks = System.<span style="color:#2B91AF">DateTime</span>.Now.Ticks</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; retVal =
<span style="color:blue">String</span>.Format(<span style="color:#A31515">&quot;{0}, {1}&quot;</span>, message.PadLeft(100), ((currentTicks - lastTicks) /
<span style="color:#2B91AF">TimeSpan</span>.TicksPerSecond).ToString().PadRight(15))</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lastTicks = currentTicks</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:blue">Return</span> retVal</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:blue">End</span> <span style="color:blue">Function</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;
<span style="color:blue">End</span> <span style="color:blue">Class</span></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">&nbsp;</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">&nbsp;</span></p>
<p class="MsoNormal" style=""><b><span style="font-size:9.0pt; font-family:&quot;Times New Roman&quot;,&quot;serif&quot;; color:#880231"><br>
</span></b><b><span style="font-size:12.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;; color:#82002C">Damien</span></b><b><span style="font-size:9.0pt; font-family:&quot;Times New Roman&quot;,&quot;serif&quot;; color:#880231">
</span></b><b><span style="font-size:12.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;; color:#880231">Atkinson-Buck</span></b><span style="font-size:12.0pt; font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><br>
</span><span style="font-size:10.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;; color:black">Head of Learning Area: Technology/Arts</span><span style="font-size:8.0pt; font-family:&quot;Times New Roman&quot;,&quot;serif&quot;; color:black">
</span></p>
<table class="MsoNormalTable" border="0" cellpadding="0">
<tbody>
<tr>
<td style="padding:.75pt 36.0pt .75pt .75pt">
<p class="MsoNormal"><b><span style="font-size:8.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;; color:black">p:</span></b><span style="font-size:8.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;; color:black"> &#43;61 3 9490 3848</span><span style="font-size:8.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;"></span></p>
</td>
<td style="padding:.75pt 36.0pt .75pt .75pt">
<p class="MsoNormal"><b><span style="font-size:8.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;; color:black">e:</span></b><span style="font-size:8.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;; color:black">
<a href="mailto:damien.atkinson-buck@ivanhoe.com.au"><span style="color:blue">damien.atkinson-buck@ivanhoe.com.au</span></a></span><span style="font-size:8.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;"></span></p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><b><span style="font-size:8.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;; color:black">f:</span></b><span style="font-size:8.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;; color:black"> &#43;61 3 9490 3490</span><span style="font-size:8.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;"></span></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><b><span style="font-size:8.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;; color:black">w:</span></b><span style="font-size:8.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;; color:black">
</span><span style="font-size:8.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;"><a href="http://www.ivanhoe.com.au"><span style="color:black">www.ivanhoe.com.au</span></a></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span style="font-size:12.0pt; font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><img border="0" width="750" height="105" id="_x0000_i1025" src="cid:image001.jpg@01CE26DA.4A99EA10"></span><span style="font-size:12.0pt; font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><br>
</span><span style="font-size:7.5pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">Please consider the environment before printing this e-mail.</span></p>
</div>
<br>
<br>
<br>
<br>
Privacy, Virus and Copyright Warning<br>
<br>
The information contained in this electronic message (e-mail), and any files transmitted with it:<br>
<br>
* is intended for the named recipients only. If you have received this in error, please advise the sender and delete it and any copies immediately;<br>
* Any personal information in this email must be used in accordance with the Privacy Act 1988 and this always applies even if it has been sent to you in error.<br>
* represents the views of the sender and does not necessarily represent the views or formal advice of Ivanhoe Grammar School;<br>
* may be subject to Copyright, so no further use should be made of it without the author's permission.<br>
<br>
The School does not represent or warrant that the email or any files attached do not contain errors or are free from computer viruses or other defects nor does it accept responsibility for any loss or damage resulting directly or indirectly from the use of
 the email or any attached files.
</body>
</html>