-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Iterating with step_by(1) is much slower than without #57517
Copy link
Copy link
Open
Labels
C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.
Metadata
Metadata
Assignees
Labels
C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Greetings!
I'd like to report that I get some significant (negative) performance impact when calling
step_by(1)on an iterator. I created a repository with a detailed description of the issue and benchmarks to reproduce it: https://github.com/mvlabat/step_by_oneThese are the functions I tested:
Calling
iter_step(vec![1; LARGE_ENOUGH], 1)computes 1.75x slower thaniter_default_step(vec![1; LARGE_ENOUGH])with
const LARGE_ENOUGH: usize = 10_000_000;.I'm running Macbook Pro 2015 with Intel i5-5257U CPU (2.70GHz).
My rustc version:
1.33.0-nightly (c2d381d39 2019-01-10).These are the exact benchmark results I got:
In the repository README there are also links to the generated asm code of these two functions.