diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e5198c0..1981b66e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,8 +34,8 @@ set(CPPUDDLE_WITH_NUMBER_BUCKETS "128" CACHE STRING "Number of internal recycle option(CPPUDDLE_WITH_COUNTERS "Turns on allocations counters. Useful for extended testing" OFF) option(CPPUDDLE_WITH_TESTS "Build tests/examples" OFF) set(CPPUDDLE_WITH_DEADLOCK_TEST_REPETITONS "100000" CACHE STRING "Number of repetitions for the aggregation executor deadlock tests") -option(CPPUDDLE_DEACTIVATE_BUFFER_RECYCLING "Deactivates the default recycling behaviour" OFF) -option(CPPUDDLE_DEACTIVATE_AGGRESSIVE_ALLOCATORS "Deactivates the aggressive allocators" OFF) +option(CPPUDDLE_WITH_BUFFER_RECYCLING "Enables the default recycling behaviour! Turning this off will have a major negative performance impact and is only intended for testing!" ON) +option(CPPUDDLE_WITH_AGGRESSIVE_CONTENT_RECYCLING "Allows the aggressive allocators variants to reuse contents from previous buffers (and thus skip initializations)" ON) # Tooling options option(CPPUDDLE_WITH_CLANG_TIDY "Enable clang tidy warnings" OFF) option(CPPUDDLE_WITH_CLANG_FORMAT "Enable clang format target" OFF) @@ -213,16 +213,18 @@ else() message(INFO " Compiling with std::mutex!") endif() -if(CPPUDDLE_DEACTIVATE_BUFFER_RECYCLING) - target_compile_definitions(buffer_manager INTERFACE "CPPUDDLE_DEACTIVATE_BUFFER_RECYCLING") - message(WARNING " Slow Build: Buffer recycling is deactivated. This should only be used for performance tests!") -else() +if(CPPUDDLE_WITH_BUFFER_RECYCLING) message(INFO " Using default buffer recycling behaviour!") +else() + message(WARNING " Slow Build: Buffer recycling is deactivated. This should only be used for performance tests!") + target_compile_definitions(buffer_manager INTERFACE "CPPUDDLE_DEACTIVATE_BUFFER_RECYCLING") endif() -if(CPPUDDLE_DEACTIVATE_AGGRESSIVE_ALLOCATORS) +if(CPPUDDLE_WITH_AGGRESSIVE_CONTENT_RECYCLING) + message(INFO " Using default behaviour for aggressive content reusage (only relevant for aggressive allocators)!") +else() target_compile_definitions(buffer_manager INTERFACE "CPPUDDLE_DEACTIVATE_AGGRESSIVE_ALLOCATORS") - message(WARNING " Slow Build: Aggressive allocators disabled. This should only be used for performance tests!") + message(WARNING " Slow Build: Aggressive allocators (and thus content recycling) is disabled. This should only be used for performance tests!") endif() # install libs with the defitions: diff --git a/include/buffer_manager.hpp b/include/buffer_manager.hpp index 32e751d9..92a5f46b 100644 --- a/include/buffer_manager.hpp +++ b/include/buffer_manager.hpp @@ -70,7 +70,7 @@ class buffer_recycler { // Warn about suboptimal performance without recycling #pragma message \ "Warning: Building without buffer recycling! Use only for performance testing! \ -For better performance configure CPPuddle with CPPUDDLE_DEACTIVATE_BUFFER_RECYCLING=OFF!" +For better performance configure CPPuddle with CPPUDDLE_WITH_BUFFER_RECYCLING=ON!" template static T *get(size_t number_elements, bool manage_content_lifetime = false, @@ -887,7 +887,7 @@ struct aggressive_recycle_allocator { // Warn about suboptimal performance without recycling #pragma message \ "Warning: Building without content reusage for aggressive allocators! \ -For better performance configure with CPPUDDLE_DEACTIVATE_AGGRESSIVE_ALLOCATORS=OFF !" +For better performance configure with CPPUDDLE_WITH_AGGRESSIVE_CONTENT_RECYCLING=ON !" template inline void construct(T *p, Args... args) noexcept { ::new (static_cast(p)) T(std::forward(args)...);