π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[rust] Avoid repeated growth when decoding packed face vectors (#14326)
laurens-pilotec4ea09d5b6b
diff --git a/rust/crates/photos/src/ml_db/vector_encoding.rs b/rust/crates/photos/src/ml_db/vector_encoding.rsindex 8bda4a3f0f..1196f795f8 100644--- a/rust/crates/photos/src/ml_db/vector_encoding.rs+++ b/rust/crates/photos/src/ml_db/vector_encoding.rs@@ -28,9 +28,13 @@ pub(crate) fn decode_evector(bytes: &[u8]) -> Result<Vec<f64>> {if length % 8 != 0 {return Err(malformed());}- for chunk in bytes[offset..offset + length].as_chunks::<8>().0 {- values.push(f64::from_le_bytes(*chunk));- }+ values.extend(+ bytes[offset..offset + length]+ .as_chunks::<8>()+ .0+ .iter()+ .map(|chunk| f64::from_le_bytes(*chunk)),+ );offset += length;}EVECTOR_VALUES_FIXED64_KEY => {