Skip to content

Commit

Permalink
added finish and clear to benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
drexlerd committed Feb 9, 2024
1 parent b3306bc commit 0fc6d42
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ else()
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -Wall -g3 -ggdb")
endif()

# set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_BUILD_TYPE "Release")

message(STATUS "Build configuration: ${CMAKE_BUILD_TYPE}")

Expand Down
3 changes: 2 additions & 1 deletion benchmarks/bitset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@ namespace flatmemory::benchmarks
VariableSizedTypeVector<Bitset<uint64_t>> views;
auto builder = Builder<Bitset<uint64_t>>();
builder.get_blocks().resize(bitset_size);
builder.finish();
for (size_t i = 0; i < num_bitsets; ++i) {
builder.finish();
views.push_back(builder);
builder.clear();
}
return views;
}
Expand Down
8 changes: 5 additions & 3 deletions include/flatmemory/details/types/vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,17 @@ namespace flatmemory
/* clear stl */
void clear_impl() {
// Clear all nested builders.
for (auto& builder : m_data) {
builder.clear();
constexpr bool is_trivial = IsTriviallyCopyable<T_>;
if constexpr (!is_trivial) {
for (auto& builder : m_data) {
builder.clear();
}
}
// Clear this builder.
m_buffer.clear();
m_dynamic_buffer.clear();
}


[[nodiscard]] ByteStream& get_buffer_impl() { return m_buffer; }
[[nodiscard]] const ByteStream& get_buffer_impl() const { return m_buffer; }

Expand Down

0 comments on commit 0fc6d42

Please sign in to comment.