-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Open
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.
Description
An issue making what would be the same code in C++ running at significantly different speed with Rust stable/beta/nightly depending on:
- The type of for loop used:
for y in buf
orfor i in 0..buf.len()
- Whether the input data is contained in a Vec, Array or Array Slice
- Whether the test algorithm is inside a function used only with Vec or Array, Array Slice inputs but not several of them.
Previously reported as #40044 with imprecision.
Current stable is 1.15.1. The issue exists pre-MIR albeit with slightly different figures.
Real world examples measured on an audio DSP algorithm
arm
- Raspberry Pi, Rustc 1.15.1: up to 34% slower
armv7
- Raspberry Pi 3, Rustc 1.15.1: up to 34% slower, Array 4% slower than Vec
- Nexus 5, Rustc 1.15: up to 38% slower, Array 1% slower than Vec
- Nexus 5X, Rustc 1.15: up to 18% slower
aarch64
- Nexus 5X, Rustc 1.15: up to 27% slower
x86-64
- Core i5-750, Rustc 1.15: up to 18% slower
Test and demo project:
https://github.com/supercurio/rust-issue-vec-array-iterators-perf
Bench results:
https://github.com/supercurio/rust-issue-vec-array-iterators-perf/tree/master/benchs
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.