Improve bounds check elision in indexing
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- rust
- Domain
- performance
Research direction
Begin with the unchecked test1d case and compare it with the completed test1d_single and test2d cases referenced in #350. Examine the generated code for the indexing loops; done means test1d compiles without extra bounds checks, as required by the example.
Written by the indexing model from the issue text.
Description
Note: We encourage higher level functionality including map, Zip, azip!() and so on before resorting indexing.
Still, it is a good benchmark to consider bounds check elision in the most trivial cases — assuming it will improve it in some less trivial cases too.
Set the goal that the following examples compile without extra bounds checks, because their loop counters are already in bounds.
pub fn test1d(a: &Array1<f64>) -> f64 {
let mut sum = 0.;
for i in 0..a.len() {
sum += a[i];
}
sum
}
pub fn test2d(a: &Array2<f64>) -> f64 {
let mut sum = 0.;
for i in 0..a.rows() {
for j in 0..a.cols() {
sum += a[[i, j]];
}
}
sum
}
- test1d_single #350
- test1d
- test2d #350
- Dominant language
- Rust
- Stars
- 4.3k
- Forks
- 391
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rust-ndarray/ndarray
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
rust-ndarray/ndarray#1612 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
rust-ndarray/ndarray#1617 · 1 comment ·
-
bug good first issue
Difficulty 3/5 1-2 days Newbie friendliness 68/100
rust-ndarray/ndarray#1615 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
rust-ndarray/ndarray#1610 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
rust-ndarray/ndarray#1609 ·
All issues in rust-ndarray/ndarray
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100