Faster iterator for arbitrary order

Abierto
#469 15 comentarios 2 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
rust
Área
data

Línea de trabajo

Review ArrayBase's existing fold, scalar_sum, and visit methods, then compare the proposed iter(), iter_mut(), indexed_iter(), and indexed_iter_mut() APIs with the listed Iterator and Itertools adapters. Done means the naming and arbitrary-order semantics are agreed and the adapters are implemented without requiring separate methods for every consumer.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

.iter() provides an iterator over all the elements, but it always iterates in logical order, which may be slow depending on the memory layout of the array. In some cases, however, the order of iteration doesn't matter. Recent issues regarding these types of cases include #466 and #468. Examples of methods where order doesn't matter include the most common uses of these from the Iterator trait

  • .fold()
  • .for_each()
  • .all() and .any()
  • .find()
  • .min(), .max(), .min_by(), .max_by(), .min_by_key(), .max_by_key()
  • .sum(), .product()

and these from Itertools

  • .cartesian_product()
  • .unique(), .unique_by()
  • .combinations()
  • .all_equal()
  • .foreach()
  • .fold_results(), .fold_options(), .fold1(), .tree_fold(), .fold_while()
  • .sorted(), .sorted_by(), .sorted_by_key()
  • .partition_map()
  • .into_group_map()
  • .minmax(), .minmax_by_key(), minmax_by()

We have already implemented some of these "arbitrary order" adapters as individual methods on ArrayBase, including .fold(), .scalar_sum(), and .visit(). However, it doesn't make sense to create separate methods for all of the possible iterator adapters.

As a result, I'd like to add "arbitrary order" .iter(), .iter_mut(), .indexed_iter(), and .indexed_iter_mut() methods designed to iterate in the fastest possible order so that we can hopefully get good performance with iterator adapters.

What does everyone think these "arbitrary order" iterators should be named?

I've thought of .iter_arbitrary() and .iter_unordered(), but those names seem somewhat unclear and unnecessarily verbose.

Lenguaje dominante
Rust
Estrellas
4.3k
Forks
391
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de rust-ndarray/ndarray

Todos los issues de rust-ndarray/ndarray

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.