bytecodealliance / bytecodealliance/cap-std

`create_dir_all` performs a quadradic number of system calls

オープン
#51 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
good first issue
主要言語
Rust
スター
821
フォーク
57
平均マージ
1時間 16分
マージ済み PR(30日)
4

説明

`create_dir_all` uses the algorithm from `libstd` for recursively creating all components. However, `cap-primitives`' `mkdir` function performs a system call per path component per call, so calling it once per path component leads to a quadratic number of system calls.

We should add a `create_dir_all` function in `cap-primitives` which, for each path component, creates a directory for that component (ignoring a `io::ErrorKind::AlreadyExists` error), opens the newly created directory, and then uses the resulting handle as the base for handling the next component.

Similar to `open_manually`, it should handle `..` components by keeping a stack of handles as it goes, so that it can simply pop an entry from that stack to ascend to the parent.

And then, the `cap-std` and `cap-async-std` `create_dir_all` routines can use it.

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

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

調査の方向性

まず、既存の cap-primitives mkdir と open_manually の実装を読み、次に新しいプリミティブを使用すべき cap-std と cap-async-std の create_dir_all ルーチンを調べます。コンポーネントの作成でディレクトリハンドルを使用し、ハンドルスタックで AlreadyExists と .. を処理し、より高レベルのルーチンがそれに委譲するようになれば、作業は完了です。

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

評価

技術スタック
rust
領域
operating-systems, security
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

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

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