From fd7e52f469b2af4d6cb61e50526cf6439e2ee046 Mon Sep 17 00:00:00 2001 From: Sam Morley <41870650+inakleinbottle@users.noreply.github.com> Date: Thu, 19 Dec 2024 10:36:56 +0000 Subject: [PATCH] Refactor classes to inherit from SmallObjectBase (#192) Added `mem::SmallObjectBase` as a base class to `StreamInterface` and `AlgebraInterfaceBase` for optimized memory handling of small objects. Updated necessary includes to ensure proper integration. This enhances performance and memory efficiency across the codebase. --- algebra/include/roughpy/algebra/interfaces/algebra_interface.h | 3 ++- streams/include/roughpy/streams/stream_base.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/algebra/include/roughpy/algebra/interfaces/algebra_interface.h b/algebra/include/roughpy/algebra/interfaces/algebra_interface.h index cdcaa5e2b..74fd9f44c 100644 --- a/algebra/include/roughpy/algebra/interfaces/algebra_interface.h +++ b/algebra/include/roughpy/algebra/interfaces/algebra_interface.h @@ -31,6 +31,7 @@ #include #include +#include "roughpy/platform/alloc.h" #include @@ -47,7 +48,7 @@ namespace dtl { * various places. If you define an algebra interface, it should derive * from the base AlgebraInterface, which publicly derives from this tag. */ -class AlgebraInterfaceBase +class AlgebraInterfaceBase : public mem::SmallObjectBase { protected: context_pointer p_ctx; diff --git a/streams/include/roughpy/streams/stream_base.h b/streams/include/roughpy/streams/stream_base.h index 7855a8bfa..e2cafc3c9 100644 --- a/streams/include/roughpy/streams/stream_base.h +++ b/streams/include/roughpy/streams/stream_base.h @@ -40,6 +40,7 @@ #include #include #include +#include "roughpy/platform/alloc.h" #include "schema.h" @@ -97,7 +98,7 @@ inline resolution_t param_to_resolution(param_t arg) noexcept * computed from log signatures, rather than using the data to compute these * independently.) */ -class ROUGHPY_STREAMS_EXPORT StreamInterface +class ROUGHPY_STREAMS_EXPORT StreamInterface : public mem::SmallObjectBase { StreamMetadata m_metadata; std::shared_ptr p_schema;