<?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-3%3Ahlin079</id>
	<title>SE250:lab-3:hlin079 - 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-3%3Ahlin079"/>
	<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-3:hlin079&amp;action=history"/>
	<updated>2026-04-28T23:53:14Z</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-3:hlin079&amp;diff=5530&amp;oldid=prev</id>
		<title>Mark: 1 revision(s)</title>
		<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-3:hlin079&amp;diff=5530&amp;oldid=prev"/>
		<updated>2008-11-03T05:19:19Z</updated>

		<summary type="html">&lt;p&gt;1 revision(s)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;====Task1====&lt;br /&gt;
When I used “push” put 4 10s at the end of the memory  the time it took was:&lt;br /&gt;
Time=0.046&lt;br /&gt;
int n[4]={1000,1000,1000,1000};&lt;br /&gt;
time =0.062000&lt;br /&gt;
&lt;br /&gt;
====task2====&lt;br /&gt;
&lt;br /&gt;
Changing the growth factor to “+20” produced the following result:&lt;br /&gt;
Time=0.297000&lt;br /&gt;
Changing the growth factor to “*3” produced the following result:&lt;br /&gt;
Time=0.062000&lt;br /&gt;
Changing the growth factor to “*6” produced the following result:&lt;br /&gt;
Time= 0.046000&lt;br /&gt;
Using a multiplicative growth factor means that a large amount of memory is allocated so that there is much space to be used in memory before the process repeats.  However, using an additive growth factor means that a constant amount of memory is allocated each time more memory is needed, and thus, the memory reallocation process is repeated more times and thus, adding several values into an array takes much longer.&lt;br /&gt;
====Task3====&lt;br /&gt;
Changing ARRAYLIST_MIN_ALLOC to 100 as opposed to 16 returned the following value:&lt;br /&gt;
Time=0.047000&lt;br /&gt;
Changing ARRAYLIST_MIN_ALLOC to 4 as opposed to 16 returned the following value:&lt;br /&gt;
Time= 0.062000&lt;br /&gt;
Using a higher ARRAYLIST_MIN_ALLOC means that with each multiplicative memory allocation, a much larger amount of memory is allocated.  Eg. Using ARRAYLIST_MIN_ALLOC = 4 means that once these 4 bytes are used, the multiplicative factor (of 2) is applied, and 8 extra bytes are allocated.  Using ARRAYLIST_MIN_ALLOC = 100, however, means that once 100 bytes are used, an extra 200 bytes are allocated and thus, the reallocation process is used much less often.&lt;br /&gt;
====Task4====&lt;br /&gt;
When ensure_capacity was used with max expected size set to “1000000” the time returned was:&lt;br /&gt;
0.061000&lt;br /&gt;
====Task5====&lt;br /&gt;
When the growth factor was changed to +1000, the time taken was:&lt;br /&gt;
0.265000&lt;br /&gt;
====Task6====&lt;br /&gt;
Using arraylist_put with index 0 took very long to compile and run as moving the used amount of memory to put new values in at the start takes much longer than adding values to the end which requires no moving of used memory.&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>