Skip to content

jychen0611/mactab-bench

Repository files navigation

mactab-bench

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

Features

  • 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

Project Structure

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 

Build

Make sure you have gcc installed.

make

Run Benchmark

./benchmark

It will generate a benchmark.csv file containing the performance results.

Example output:

Name,Insert Time,Lookup Time,VmPeak(kB),VmRSS(kB)
Linked List,0.0031,5.4132,5724,4576

Plot Results

Install matplotlib if you have not:

pip install matplotlib

Run

python3 plot.py

LRU size 50000

alt text

alt text

Miss Rate vs LRU Cache Size under Hot/Cold Traffic

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.

alt text

Results Summary

More hot data (20%) needs larger cache to keep miss rate low!

Third-Party Code

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.

About

A simple benchmark project for evaluating different MAC address table implementations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors