diff --git a/README.md b/README.md index faec616..a35f49d 100644 --- a/README.md +++ b/README.md @@ -33,16 +33,27 @@ private: int i = 15; }; ``` +On Linux: ``` Time (milliseconds) required for allocations without pool: 21 Time (milliseconds) required for allocations with pool: 3 Time (milliseconds) required for real allocations when constructing pool: 9 ``` +On Windows: +``` +Time (milliseconds) required for allocations without pool: 62 +Time (milliseconds) required for allocations with pool: 6 +Time (milliseconds) required for real allocations when constructing pool: 51 +``` This trivial example shows some performance improvements that would be much more important should the allocation and construction/destruction of the objects be more complex. +In the case where the allocator is very fast (such as glibc's on Linux) this approach +may not be necessary, but in the case of slow allocators (such as Windows' default), it +could be interesting to consider such an approach. + ## Safety AddressSanitizer, LeakSanitizer and ThreadSanitizer have been used to ensure the safety of the class. Tests have been added to ensure the correct behavior in all cases. \ No newline at end of file diff --git a/allocPool.hpp b/allocPool.hpp index e542c58..d4ef1ba 100644 --- a/allocPool.hpp +++ b/allocPool.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include