A simple benchmark project for evaluating different MAC address table implementations:
- Linked List: simple insertion and linear search
- uthash Hash Table: fast lookup
- uthash + LRU: fast lookup with memory management
- Compare insertion and lookup performance
- Support Least Recently Used (LRU) eviction when MAC table is full
- Monitor memory usage (VmRSS and VmPeak)
- Visualize benchmark results using matplotlib
mactab-bench/
├── benchmark.c
├── list.h
├── list.c
├── hash.h
├── hash.c
├── lru.h
├── lru.c
├── ut_hash.h
├── Makefile
├── benchmark.csv (auto generated after run)
├── sweep_result.csv (auto generated after run)
├── plot.py (plotting script)
└── README.md
Make sure you have gcc installed.
make./benchmarkIt will generate a benchmark.csv file containing the performance results.
Name,Insert Time,Lookup Time,VmPeak(kB),VmRSS(kB)
Linked List,0.0031,5.4132,5724,4576
Install matplotlib if you have not:
pip install matplotlibpython3 plot.py
This experiment evaluates how the miss rate of a cache system changes with different LRU cache sizes under hot/cold traffic patterns.
It aims to show the relationship between cache capacity, traffic locality, and lookup success rate.
We test different LRU cache sizes (10k–100k) and hot data ratios (5%, 10%, 20%) to evaluate the cache miss rate under hot/cold traffic patterns.
The goal is to see how cache size and traffic locality affect system performance.
More hot data (20%) needs larger cache to keep miss rate low!
This project includes uthash, a simple hash table library for C, under the BSD 2-clause license. The license notice is preserved in ut_hash.h.


