Faster iterator for arbitrary order

オープン
#469 コメント 15 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
rust
領域
data

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

.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.

主要言語
Rust
スター
4.3k
フォーク
391
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rust-ndarray/ndarray のほかの issue

rust-ndarray/ndarray の issue をすべて見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。