bytecodealliance / bytecodealliance/cap-std
`create_dir_all` performs a quadradic number of system calls
- Lenguaje dominante
- Rust
- Estrellas
- 821
- Forks
- 57
- Merge medio
- 1 h 16 min
- PR fusionados (30 d)
- 4
Descripción
`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.
Guía de contribución
Línea de trabajo
Start by reading the existing cap-primitives mkdir and open_manually implementations, then inspect the cap-std and cap-async-std create_dir_all routines that should use the new primitive. The work is complete when component creation uses directory handles, handles AlreadyExists and .. with a handle stack, and the higher-level routines delegate to it.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- rust
- Área
- operating-systems, security
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 38/100