AlexanderSaydakov commented on code in PR #332:
URL: https://github.com/apache/datasketches-cpp/pull/332#discussion_r1089274551
##########
theta/include/theta_sketch_impl.hpp:
##########
@@ -377,156 +372,355 @@ auto compact_theta_sketch_alloc<A>::serialize(unsigned
header_size_bytes) const
vector_bytes bytes(size, 0, entries_.get_allocator());
uint8_t* ptr = bytes.data() + header_size_bytes;
- ptr += copy_to_mem(preamble_longs, ptr);
- const uint8_t serial_version = SERIAL_VERSION;
- ptr += copy_to_mem(serial_version, ptr);
- const uint8_t type = SKETCH_TYPE;
- ptr += copy_to_mem(type, ptr);
+ *ptr++ = preamble_longs;
+ *ptr++ = UNCOMPRESSED_SERIAL_VERSION;
+ *ptr++ = SKETCH_TYPE;
ptr += sizeof(uint16_t); // unused
const uint8_t flags_byte(
(1 << flags::IS_COMPACT) |
(1 << flags::IS_READ_ONLY) |
(this->is_empty() ? 1 << flags::IS_EMPTY : 0) |
(this->is_ordered() ? 1 << flags::IS_ORDERED : 0)
);
- ptr += copy_to_mem(flags_byte, ptr);
- const uint16_t seed_hash = get_seed_hash();
- ptr += copy_to_mem(seed_hash, ptr);
+ *ptr++ = flags_byte;
+ ptr += copy_to_mem(get_seed_hash(), ptr);
Review Comment:
I thought that using copy_to_mem for bytes was unnecessary clutter and
potential slowdown
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]