Skip to content

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

License

Notifications You must be signed in to change notification settings

Kautenja/object-pool

Repository files navigation

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++.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published