Improve bounds check elision in indexing

Aperta
#349 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
rust
Ambito
performance

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement performance

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
Lingua principale
Rust
Stelle
4.3k
Fork
391
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rust-ndarray/ndarray

Tutte le issue di rust-ndarray/ndarray

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.