Skip to content

Commit

Permalink
Optimization comments, move stream.set_limit() to debug.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed Jun 13, 2024
1 parent b2a79b4 commit 181dbd5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions include/bitcoin/database/impl/primitives/hashmap.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ bool CLASS::set(const Link& link, const Element& element) NOEXCEPT
finalizer sink{ stream };
sink.skip_bytes(index_size);

if constexpr (!is_slab) { sink.set_limit(Size); }
// (1.65%)
if constexpr (!is_slab) { BC_DEBUG_ONLY(sink.set_limit(Size);) }
return element.to_data(sink);
}

Expand Down Expand Up @@ -306,7 +307,7 @@ bool CLASS::put(const Link& link, const Key& key,
return head_.push(link, next, index);
});

if constexpr (!is_slab) { sink.set_limit(Size * count); }
if constexpr (!is_slab) { BC_DEBUG_ONLY(sink.set_limit(Size * count);) }
return element.to_data(sink) && sink.finalize();
}

Expand Down Expand Up @@ -364,7 +365,7 @@ bool CLASS::read(const memory_ptr& ptr, const Link& link,
iostream stream{ offset, size - position };
reader source{ stream };
source.skip_bytes(index_size);
if constexpr (!is_slab) { source.set_limit(Size); }
if constexpr (!is_slab) { BC_DEBUG_ONLY(source.set_limit(Size);) }
return element.from_data(source);
}

Expand Down

0 comments on commit 181dbd5

Please sign in to comment.