From 243e06b3477e060749e28029fe5aef0e7c8d6d60 Mon Sep 17 00:00:00 2001 From: Hadrien Grasland Date: Fri, 5 Apr 2024 14:55:05 +0200 Subject: [PATCH] Warn that fold_ilp does not like iterators of references --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/lib.rs | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 06598a5..5efd2f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -288,7 +288,7 @@ dependencies = [ [[package]] name = "iterator_ilp" -version = "2.1.1" +version = "2.1.2" dependencies = [ "criterion", "hwlocality", diff --git a/Cargo.toml b/Cargo.toml index c92de08..e6a90ae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ name = "iterator_ilp" # - Roll an annotated git tag # - Add a github release # -version = "2.1.1" +version = "2.1.2" authors = ["Hadrien G. "] edition = "2021" rust-version = "1.71.0" diff --git a/src/lib.rs b/src/lib.rs index 4d1f427..a9e9ddf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -249,6 +249,12 @@ use num_traits::{One, Zero}; /// reduction callable will observe a different sequence of inputs, so it should /// not rely on ordering of inputs for correctness. /// +/// Although many numerical types implement `Add<&T>` in addition to `Add` +/// for user convenience, due to compiler limitations, better performance will +/// often be achieved when iterating over numerical types by value, rather than +/// by reference. If you have an iterator of references, you can usually achieve +/// this by calling [`Iterator::copied()`]. +/// /// # Sum and product /// /// The definition of the [`Sum`] and [`Product`] traits is very high-level and