Skip to content

Razeza/HashTable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HashTable

The task was to write HashTable on my list, check, how storage of lists changes with different hash and optimize it with inline assembly. There were seven hash-functions:

  1. Returns 1
  2. Returns word's length
  3. Returns sum of ASCII symbols
  4. Returns sum of ASCII symbols divided by word's length
  5. MurMur Hash
  6. Fletcher Hash

Optimization

First of all I saw what functions are the slowest As you can see the most part of runtime takes strcmp and strlen, so I decided to optimize them. I could use xmm or sse, but I tried another way, because it could be rational, if all words were long. Firstly I wrote the simplest algorithms of these functions
Strcmp:

Strlen:

and I was surprised by the results:
As you see I won compiler option -O3, so I ended my optimization
Coefficents:

Type -O0 -O2 -O3
Without inline asm 0.57 0.88 1.00
Inline asm 1.09 1.23 1.26

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published