tisonkun commented on code in PR #396:
URL: https://github.com/apache/datasketches-rust/pull/396#discussion_r4643565370


##########
datasketches/src/hash/murmurhash.rs:
##########
@@ -110,6 +105,51 @@ impl MurmurHash3X64128 {
         self.h2 = self.h2.wrapping_add(self.h1);
         self.h2 = self.h2.wrapping_mul(5).wrapping_add(0x38495ab5);
     }
+
+    #[inline(always)]
+    fn write_fixed<const N: usize>(&mut self, bytes: [u8; N]) {
+        debug_assert!(N <= 16);
+        if N == 16 && self.buf_len == 0 {
+            self.total = self.total.wrapping_add(16);
+            self.update(read_u64_le(&bytes[..8]), read_u64_le(&bytes[8..]));
+        } else if self.buf_len + N < 16 {

Review Comment:
   Good catch. `8 + 8` hit the `buf_len + N < 16` check and fell back to 
`write_buffered`.
   
   Updated `write_fixed` (and `write_buffered`) to fold in registers inline, 
and expanded `hll::update` to cover `(u64, u64)` (`u64_pair`) and 
length-prefixed slices (`prefixed_bytes`) alongside `u64` and `raw_bytes`. On 
M4 Max (`main` vs `6f0ed37`, 7 pairs):
   
   - `hll::update::u64`: 261 [257, 263] -> 271 [268, 275] ms
   - `hll::update::u64_pair`: 291 [287, 301] -> 300 [294, 306] ms
   - `hll::update::variable_bytes`: 280 [279, 281] -> 142 [142, 143] ms
   - `hll::update::prefixed_bytes`: 267 [265, 269] -> 120 [118, 126] ms



-- 
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]

Reply via email to