-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[core] Reduce allocation / deallocations necessary for Registration. #1744
Conversation
…allocating elements.
… registration sample." This reverts commit b4a5329ba7d5c13f36d4c37ea5b6356d411679dc.
… to avoid memory allocations.
Small fixes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
@@ -0,0 +1,180 @@ | |||
#include <gtest/gtest.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'gtest/gtest.h' file not found [clang-diagnostic-error]
#include <gtest/gtest.h>
^
}; | ||
|
||
// Test push_back and size functionality | ||
TEST_F(CExpandingVectorTest, PushBackAndSize) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
TEST_F(CExpandingVectorTest, PushBackAndSize) { | |
TEST_F(CExpandingVectorTest /*unused*/, PushBackAndSize /*unused*/) { |
} | ||
|
||
// Test clear functionality | ||
TEST_F(CExpandingVectorTest, ClearElements) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
TEST_F(CExpandingVectorTest, ClearElements) { | |
TEST_F(CExpandingVectorTest /*unused*/, ClearElements /*unused*/) { |
} | ||
|
||
// Test resize functionality | ||
TEST_F(CExpandingVectorTest, ResizeVector) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
TEST_F(CExpandingVectorTest, ResizeVector) { | |
TEST_F(CExpandingVectorTest /*unused*/, ResizeVector /*unused*/) { |
} | ||
|
||
// Test empty() function | ||
TEST_F(CExpandingVectorTest, EmptyFunction) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
TEST_F(CExpandingVectorTest, EmptyFunction) { | |
TEST_F(CExpandingVectorTest /*unused*/, EmptyFunction /*unused*/) { |
} | ||
|
||
// Test capacity and full_size functions | ||
TEST_F(CExpandingVectorTest, FullSize) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
TEST_F(CExpandingVectorTest, FullSize) { | |
TEST_F(CExpandingVectorTest /*unused*/, FullSize /*unused*/) { |
} | ||
|
||
|
||
TEST_F(CExpandingVectorTest, Front) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
TEST_F(CExpandingVectorTest, Front) { | |
TEST_F(CExpandingVectorTest /*unused*/, Front /*unused*/) { |
} | ||
|
||
// Test back function | ||
TEST_F(CExpandingVectorTest, Back) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
TEST_F(CExpandingVectorTest, Back) { | |
TEST_F(CExpandingVectorTest /*unused*/, Back /*unused*/) { |
} | ||
|
||
// Test front and back with an empty vector (should throw an exception) | ||
TEST_F(CExpandingVectorTest, FrontAndBackEmptyVector) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
TEST_F(CExpandingVectorTest, FrontAndBackEmptyVector) { | |
TEST_F(CExpandingVectorTest /*unused*/, FrontAndBackEmptyVector /*unused*/) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
using core_cpp_util_expanding_vector = CExpandingVectorTest; | ||
|
||
// Test push_back and size functionality | ||
TEST_F(core_cpp_util_expanding_vector, PushBackAndSize) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
TEST_F(core_cpp_util_expanding_vector, PushBackAndSize) { | |
TEST_F(core_cpp_util_expanding_vector /*unused*/, PushBackAndSize /*unused*/) { |
} | ||
|
||
// Test clear functionality | ||
TEST_F(core_cpp_util_expanding_vector, ClearElements) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
TEST_F(core_cpp_util_expanding_vector, ClearElements) { | |
TEST_F(core_cpp_util_expanding_vector /*unused*/, ClearElements /*unused*/) { |
} | ||
|
||
// Test resize functionality | ||
TEST_F(core_cpp_util_expanding_vector, ResizeVector) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
TEST_F(core_cpp_util_expanding_vector, ResizeVector) { | |
TEST_F(core_cpp_util_expanding_vector /*unused*/, ResizeVector /*unused*/) { |
} | ||
|
||
// Test operator[] without bounds checking | ||
TEST_F(core_cpp_util_expanding_vector, OperatorAccess) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
TEST_F(core_cpp_util_expanding_vector, OperatorAccess) { | |
TEST_F(core_cpp_util_expanding_vector /*unused*/, OperatorAccess /*unused*/) { |
} | ||
|
||
// Test at() function with bounds checking | ||
TEST_F(core_cpp_util_expanding_vector, AtFunction) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
TEST_F(core_cpp_util_expanding_vector, AtFunction) { | |
TEST_F(core_cpp_util_expanding_vector /*unused*/, AtFunction /*unused*/) { |
} | ||
|
||
// Test empty() function | ||
TEST_F(core_cpp_util_expanding_vector, EmptyFunction) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
TEST_F(core_cpp_util_expanding_vector, EmptyFunction) { | |
TEST_F(core_cpp_util_expanding_vector /*unused*/, EmptyFunction /*unused*/) { |
} | ||
|
||
// Test capacity and full_size functions | ||
TEST_F(core_cpp_util_expanding_vector, FullSize) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
TEST_F(core_cpp_util_expanding_vector, FullSize) { | |
TEST_F(core_cpp_util_expanding_vector /*unused*/, FullSize /*unused*/) { |
} | ||
|
||
|
||
TEST_F(core_cpp_util_expanding_vector, Front) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
TEST_F(core_cpp_util_expanding_vector, Front) { | |
TEST_F(core_cpp_util_expanding_vector /*unused*/, Front /*unused*/) { |
} | ||
|
||
// Test back function | ||
TEST_F(core_cpp_util_expanding_vector, Back) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
TEST_F(core_cpp_util_expanding_vector, Back) { | |
TEST_F(core_cpp_util_expanding_vector /*unused*/, Back /*unused*/) { |
} | ||
|
||
// Test front and back with an empty vector (should throw an exception) | ||
TEST_F(core_cpp_util_expanding_vector, FrontAndBackEmptyVector) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
TEST_F(core_cpp_util_expanding_vector, FrontAndBackEmptyVector) { | |
TEST_F(core_cpp_util_expanding_vector /*unused*/, FrontAndBackEmptyVector /*unused*/) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me as reviewed together in the meetingv yesterday.
Description
In bigger, idle eCAL System there is quite a large "Grundlast" in the system, due to how Registrations are processed.
This PR tries to solve that, by providing a
Util::CExpandingVector
which only deallocates members upon destruction, and avoiding any unnessesary instatiations ofeCAL::Sample
instances.