<?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-5%3Astsa027</id>
	<title>SE250:lab-5:stsa027 - 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-5%3Astsa027"/>
	<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-5:stsa027&amp;action=history"/>
	<updated>2026-06-08T20:34:29Z</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-5:stsa027&amp;diff=6854&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-5:stsa027&amp;diff=6854&amp;oldid=prev"/>
		<updated>2008-11-03T05:19:56Z</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;Had a slight problem when trying to compile all .c files together.  Was supposed to use &amp;#039;*.c&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
Had another slight problem - misunderstood the meanings of the parameters we were supposed to set for ourselves.  When I understood properly, the three values were 10,000, 7,500 and 2,500.&lt;br /&gt;
&lt;br /&gt;
sample_size was 10000.  Chosen because I thought it was adequately large.&lt;br /&gt;
n_keys was 7500, with the table_size 1/3 of that, at 2500, which means that each linked list in the hash table will be at least 3 elements long, and which I thought was a good test of the hash functions.&lt;br /&gt;
&lt;br /&gt;
==Results==&lt;br /&gt;
&lt;br /&gt;
===buzhash===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
buzhash low	7.98550	99.00%	125.825	1.26%	-0.000047&lt;br /&gt;
buzhash low 7500/2500: llps = 10, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
buzhash typical	7.97970	25.00%	127.177	1.95%	-0.007153&lt;br /&gt;
buzhash typcial 7500/2500: llps = 10, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
buzhash	7.98550	99.00%	125.825	1.26%	-0.000047&lt;br /&gt;
buzhash RC 7500/2500: llps_i = 132, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===buzhashn===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
buzhashn low	7.98214	50.00%	127.589	2.10%	0.000600&lt;br /&gt;
buzhashn low 7500/2500: llps = 7499, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
lab-5.c:332: warning: passing arg 4 of `llps&amp;#039; from incompatible pointer type&lt;br /&gt;
buzhashn typical	7.98214	50.00%	127.589	2.10%	0.000600&lt;br /&gt;
buzhashn typcial 7500/2500: llps = 7499, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
buzhashn	7.98214	50.00%	127.589	2.10%	0.000600&lt;br /&gt;
buzhashn RC 7500/2500: llps_i = 12, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===hash_CRC===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hash_CRC low	7.98214	50.00%	127.589	2.10%	0.000600&lt;br /&gt;
hash_CRC low 7500/2500: llps = 7499, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hash_CRC typical	7.98214	50.00%	127.589	2.10%	0.000600&lt;br /&gt;
hash_CRC typical 7500/2500: llps = 10, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hash_CRC	4.80204	0.01%	95.131	26.41%	-0.380808&lt;br /&gt;
hash_CRC 7500/2500: llps_i = 32, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Java_Integer===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Java_Integer_hash low	4.11606	0.01%	32.385	27.32%	-0.217081&lt;br /&gt;
Java_Integer 7500/2500: llps = 5, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Java_Integer_hash typical	4.11606	0.01%	32.385	27.32%	-0.217081&lt;br /&gt;
Java_Integer typical 7500/2500: llps = 796, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Java_Integer	4.11606	0.01%	32.385	27.32%	-0.217081&lt;br /&gt;
Java_Integer 7500/2500: llps_i = 3, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Java_Object===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Java_Object_hash low	2.00000	0.01%	77.000	27.32%	-0.521556&lt;br /&gt;
Java_Object  7500/2500: llps = 7500, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Java_Object typical	4.93157	0.01%	116.582	25.87%	-0.506511&lt;br /&gt;
Java_Object typical 7500/2500: llps = 22, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Java_Object	2.00000	0.01%	77.000	27.32%	-0.521556&lt;br /&gt;
Java_Object 7500/2500: llps_i = 7500, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Java_String===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Java_String_hash low	7.99453	99.99%	127.683	1.03%	0.003125&lt;br /&gt;
Java_String low 7500/2500: llps = 6, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Java_String typical	7.89301	0.01%	126.009	1.42%	-0.021360&lt;br /&gt;
Java_String typical 7500/2500: llps = 10, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Java_String	7.99453	99.99%	127.683	1.03%	0.003125&lt;br /&gt;
Java_String 7500/2500: llps_i = 31, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===base256===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
base256	low 0.00000	0.01%	97.000	27.32%	undefined&lt;br /&gt;
base256 low 7500/2500: llps = 7500, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
base256 typical	3.90309	0.01%	107.987	27.32%	0.079032&lt;br /&gt;
base256 typical 7500/2500: llps = 221, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
base256	0.00000	0.01%	97.000	27.32%	undefined&lt;br /&gt;
base256 7500/2500: llps_i = 32, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===high_rand===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Analysis==&lt;br /&gt;
&lt;br /&gt;
===Theoretical Ranking===&lt;br /&gt;
Theoretical Ranking from highest to lowest, using entropy values.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Low_Entropy&lt;br /&gt;
&lt;br /&gt;
1. Java_String_hash low	     7.99453&lt;br /&gt;
2. buzhash low	             7.98550&lt;br /&gt;
3. hash_CRC low	             7.98214&lt;br /&gt;
4. buzhashn low	             7.98214&lt;br /&gt;
5. Java_Integer_hash low     4.11606&lt;br /&gt;
6. Java_Object_hash low	     2.00000&lt;br /&gt;
7. base256	             0.00000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Typical_Entropy&lt;br /&gt;
&lt;br /&gt;
1. buzhashn typical	     7.98214&lt;br /&gt;
2. hash_CRC typical	     7.98214&lt;br /&gt;
3. buzhash typical	     7.97970&lt;br /&gt;
4. Java_String typical	     7.89301&lt;br /&gt;
5. Java_Object typical	     4.93157&lt;br /&gt;
6. Java_Integer_hash typical 4.11606&lt;br /&gt;
7. base256 typical	     3.90309&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The rankings between the different hash functions were fairly similar when using low_entropy or high_entropy values.  base256 hash function performed the most poorly, with the lowest entropy value in both cases.  The highest ranking 4 hash functions in both cases are the same.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Practical Ranking===&lt;br /&gt;
Practical ranking using worst case list length.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Low_Entropy&lt;br /&gt;
&lt;br /&gt;
Prac. Ranking ( Theoretical Ranking)  longest list expected longest list&lt;br /&gt;
&lt;br /&gt;
1.(5) Java_Integer 7500/2500:         llps = 5,    expecting 10.6686&lt;br /&gt;
2.(1) Java_String low 7500/2500:      llps = 6,    expecting 10.6686&lt;br /&gt;
3.(2) buzhash low 7500/2500:          llps = 10,   expecting 10.6686&lt;br /&gt;
4.(3) hash_CRC typical 7500/2500:     llps = 10,   expecting 10.6686&lt;br /&gt;
5.(4) buzhashn low 7500/2500:         llps = 7499, expecting 10.6686&lt;br /&gt;
6.(7) base256 low 7500/2500:          llps = 7500, expecting 10.6686&lt;br /&gt;
7.(6) Java_Object  7500/2500:         llps = 7500, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, the hash functions gave had a high entropy value of ~7 (the thoretically best 4) generally perform fairly well in the practical test, except for the buzhashn function, which gave a very long linked list (7499).  Also, the Java_Interger_hash function performed much better than suggested by the thoretical entropy value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Typical_Entropy&lt;br /&gt;
&lt;br /&gt;
Prac. Ranking ( Theoretical Ranking)  longest list expected longest list&lt;br /&gt;
&lt;br /&gt;
1.(3) buzhash typcial 7500/2500:      llps = 10,   expecting 10.6686&lt;br /&gt;
2.(4) Java_String typical 7500/2500:  llps = 10,   expecting 10.6686&lt;br /&gt;
3.(2) hash_CRC typical 7500/2500:     llps = 10,   expecting 10.6686&lt;br /&gt;
4.(5) Java_Object typical 7500/2500:  llps = 22,   expecting 10.6686&lt;br /&gt;
5.(7) base256 typical 7500/2500:      llps = 221,  expecting 10.6686&lt;br /&gt;
6.(6) Java_Integer typical 7500/2500: llps = 796,  expecting 10.6686&lt;br /&gt;
7.(1) buzhashn typcial 7500/2500:     llps = 7499, expecting 10.6686&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hash functions generally perform better when the inputs are from typical_entropy_src, where base256 and Java_Object no longer have 7500 element long linked lists.  However, buzhashn performed equally poorly as before, unexpected from the high entropy value obtained theoretically.&lt;br /&gt;
&lt;br /&gt;
The expected worst case was quite accurate when values of typical entropy were used, with the best 3 performing ones having a worst case of 10, when 10.6686 was expected.&lt;br /&gt;
&lt;br /&gt;
However the expected worst case was not as accurate&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>