bytecodealliance / bytecodealliance/cap-std
`create_dir_all` performs a quadradic number of system calls
- Langage dominant
- Rust
- Étoiles
- 821
- Forks
- 57
- Merge moyen
- 1 h 16 min
- PR mergées (30 j)
- 4
Description
`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.
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par lire les implémentations existantes de cap-primitives mkdir et open_manually, puis examinez les routines create_dir_all de cap-std et cap-async-std, qui devraient utiliser la nouvelle primitive. Le travail est terminé lorsque la création de composants utilise des handles de répertoire, gère AlreadyExists et .. avec une pile de handles, et que les routines de niveau supérieur lui délèguent.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- rust
- Domaine
- operating-systems, security
- Type d'issue
- Fonctionnalité
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 38/100