Kautenja / object-pool

A simple template implementation of an object pool in C++.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Object Pool

build-status

Usage

Simply add include/object_pool.hpp to your C++ project either by copying directly or using git submodules.

Classes

There are two working implementations of the object pool, (1) the object managed pool that stores objects on the stack using a vector, and (2) the object pointer pool that stores objects dynamically in memory. benchmark/benchmark.cpp contains code to benchmark the objects (using doubles as the template object type).

Class Object location get & put avg. time
ObjectManagedPool Stack 194_ns_ (267_ns_ std.)
ObjectPointerPool Heap 47_ns_ (2_ns_ std.)

The ObjectPool class defaults to the faster (and simpler) ObjectPointerPool class.

Testing

To compile and run the test suite:

scons test

Benchmarking

To run benchmarks:

scons benchmark/benchmark.cpp

About

A simple template implementation of an object pool in C++.

License:MIT License


Languages

Language:C++ 65.2%Language:Python 34.8%