bytecodealliance / bytecodealliance/cap-std

`create_dir_all` performs a quadradic number of system calls

Aperta
#51 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
good first issue
Lingua principale
Rust
Stelle
821
Fork
57
Merge medio
1h 16m
PR unite (30g)
4

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.