The following is a sample Makefile for simple project, here I am building a simple “Bloom Filter” library, and “main” program to use it. The library will have the following files:
* hash.h and hash.c
* bloom.h and bloom.c and we should get “libbloom.a” out of it. The “main” program will use:

main.c

bloom.h

libbloom.a and we should get “main” executable. So our make file should look like this:

Few months ago I read an interesting post by Mike Haertel the original author of GNU grep titled “why GNU grep is fast“, one of the reason given is loop unrolling.
Few weeks ago I came a cross the same post which made me more interested on Loop Unrolling, so I decided to experiment with it, I implemented simple function to search for an item inside a list of items, and return as soon as it finds it, soo here is my result:

First

Middle

Not in Array

Normal Loop

0.387

1.495

2.605

Unrolled Loop

0.397

1.07

1.701

Improvement

-2.52

39.72

53.15

O2 Normal Loop

0.045

0.279

0.373

O2 Unrolled Loop

0.045

0.217

0.285

Improvement

0.00

28.57

30.88

The result is taken using the “time” command, “O2” means compiling the program with optimization level 2.