Hacker News new | ask | show | jobs
by msarnoff 34 days ago
This was a class assignment in the 15-213 class at Carnegie Mellon. The staff had set up a test suite and an online leaderboard to rank the speed of each student's malloc implementation.

I figured out that the test cases allocated a disproportionate amount of X-byte blocks. I was able to get to the top by hardcoding a specific freelist just for X-byte blocks.

Learned a lesson about easily it is to game a benchmark :)

1 comments

This is a useful lesson! Tuning an allocator for a single application reduces to optimizing for that application’s empirical allocation patterns (sizes, lifetimes, access, usage).