<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3Alab-1%3Atlou006</id>
	<title>SE250:lab-1:tlou006 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3Alab-1%3Atlou006"/>
	<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-1:tlou006&amp;action=history"/>
	<updated>2026-04-29T14:50:33Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.kram.nz/index.php?title=SE250:lab-1:tlou006&amp;diff=4554&amp;oldid=prev</id>
		<title>Mark: 2 revision(s)</title>
		<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-1:tlou006&amp;diff=4554&amp;oldid=prev"/>
		<updated>2008-11-03T05:18:45Z</updated>

		<summary type="html">&lt;p&gt;2 revision(s)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Couldn&amp;#039;t remember anything about programming. &lt;br /&gt;
Had trouble setting up Visual Studio.&lt;br /&gt;
Was confused about the clock() function so asked person next to me. Assumed clock() returned the current computer time.&lt;br /&gt;
Two variables &amp;#039;&amp;#039;&amp;#039;start&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;finish&amp;#039;&amp;#039;&amp;#039; was used; &amp;#039;&amp;#039;&amp;#039;start&amp;#039;&amp;#039;&amp;#039; was set at the beginning of the loop and &amp;#039;&amp;#039;&amp;#039;finish&amp;#039;&amp;#039;&amp;#039; was set to the time when the loop finished. Total time taken was &amp;#039;&amp;#039;&amp;#039;finish - start&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Had trouble compiling due to syntax errors.&lt;br /&gt;
&lt;br /&gt;
Some results using a for loop&lt;br /&gt;
	for (i=0; i&amp;lt;loop; i++){&lt;br /&gt;
		a = 1 + 1;&lt;br /&gt;
	}&lt;br /&gt;
where &amp;#039;&amp;#039;&amp;#039;a&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;i&amp;#039;&amp;#039;&amp;#039; are integers&lt;br /&gt;
&lt;br /&gt;
100000000loops = 220ms&lt;br /&gt;
&lt;br /&gt;
110000000loops = 243ms&lt;br /&gt;
&lt;br /&gt;
120000000loops = 266ms&lt;br /&gt;
&lt;br /&gt;
130000000loops = 286ms&lt;br /&gt;
&lt;br /&gt;
Made loops bigger by a factor of 10 and times increased by a factor of 10 as expected&lt;br /&gt;
&lt;br /&gt;
1000000000loops = 2209ms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1100000000loops = 2409ms&lt;br /&gt;
&lt;br /&gt;
1200000000loops = 2693ms&lt;br /&gt;
&lt;br /&gt;
1300000000loops = 2872ms&lt;br /&gt;
&lt;br /&gt;
Found something when increasing loop size&lt;br /&gt;
&lt;br /&gt;
2000000000loops = 4334ms,&lt;br /&gt;
&lt;br /&gt;
2100000000loops = 4717ms,&lt;br /&gt;
&lt;br /&gt;
&amp;gt;2200000000loops = 0??,&lt;br /&gt;
&lt;br /&gt;
When loop size is greater than 22billion the time returned is 0&lt;br /&gt;
&lt;br /&gt;
Does the computer give up and not bother to calculate??&lt;br /&gt;
&lt;br /&gt;
Also ran tests using double and float data types&lt;br /&gt;
Their addition was slower by ~10%&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Loop code speed also should be taken into account. &lt;br /&gt;
Possible way to do this is to run the addition without a loop.&lt;br /&gt;
&lt;br /&gt;
eg. a = 1 + 1;&lt;br /&gt;
&lt;br /&gt;
a = 1 + 1;&lt;br /&gt;
&lt;br /&gt;
a = 1 + 1;&lt;br /&gt;
&lt;br /&gt;
a = 1 + 1;&lt;br /&gt;
&lt;br /&gt;
a = 1 + 1;&lt;br /&gt;
.... etc&lt;br /&gt;
&lt;br /&gt;
I also heard that a &amp;#039;&amp;#039;&amp;#039;while loop&amp;#039;&amp;#039;&amp;#039; was faster than a &amp;#039;&amp;#039;&amp;#039;for loop&amp;#039;&amp;#039;&amp;#039;, but was unable to experiment because I ran out of time =(&lt;br /&gt;
&lt;br /&gt;
Need more practice with this.&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>