From b0cbb7455bd83909da091872463f723649c3d14c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Leclaire-Fournier?= Date: Sun, 3 Mar 2024 14:40:55 -0500 Subject: [PATCH] =?UTF-8?q?allocPool:=20R=C3=A9pare=20compilation=20sur=20?= =?UTF-8?q?Windows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 11 +++++++++++ allocPool.hpp | 1 + 2 files changed, 12 insertions(+) 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