aantropov / memory-allocator-contest

An evaluation platform for memory allocators in C++. We comparing self-made allocators with default malloc/free and participants.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Memory allocator contest

This repo is an evaluation platform for memory allocators in C++. We comparing self-made allocators with default malloc/free and participants.

Why?

Default C's malloc/free allocator is effective in memory consumption, but works slow, when comparing with other approaches which are not-so strong in memory economy.

So in this contest we testing custom-developed allocators with the standard one by measuring average relation speed to memory overhead.

Scores computation

To compare allocators we compute and sum scores for several tests: small, medium, large, random. The more the total sum - the better.

The score for each test is inversely proportional to the computation time and memory overhead.

Running the tests

The allocator test environment works in Windows, VS 2019. You need at least 16 Gb of RAM, and 80 Gb of swap disks.

Testing your own allocator

To develop and test your allocator, do the following:

  1. Use DefaultMallocAllocator at MemoryAllocatorContest.cpp as a scratch.

  2. Add your class to the list of allocators to test at the beginning of the main(): results.push_back(TestCase_MemoryPerformance<...>::RunTests());

(Of course it's better to comment others allocator testing during your development.)

  1. Run. The program outputs total scores and forms results.html with graphs of time and memory consumption.

Results

The results are in folder MemoryAllocatorResults, especially Results.txt file.

Allocators implementations discussion

  • AlexeiMikhailov: uses pools 2^n and lists.

  • OlegApanasik: uses 2^n multi-pools with free-list and without any loop.

  • DefaultMallocAlloc: default malloc/free allocator. Slow but very effective in memory.

  • DaniilPavlenko: uses single multiset to store all free memory chunks.

  • AlexeyAntropov: uses multi-pools O(1) for small allocations [1, 256] and heap allocator with varied block size, ~O(sqrt(n)) for alloc and O(1) for free, where n is num of blocks in free list.

  • DenisPerevalov: uses several 2^n pools without reusing. Parameters (table[]) are tweaked specially to maximize the scores.

  • AntonShatalov: uses binary-coded 6-tree with cache-usage optimizations. Extremely fast on Medium test.

About

An evaluation platform for memory allocators in C++. We comparing self-made allocators with default malloc/free and participants.


Languages

Language:HTML 51.1%Language:C++ 48.9%