mirror of
https://codeberg.org/ziglang/zig
synced 2026-11-18 07:05:05 +00:00
fs: Optimize Dir.deleteTree for non-deeply-nested directories
`deleteTree` now uses a stack-allocated stack for the first 16 nested directories, and then falls back to the previous implementation (which only keeps 1 directory open at a time) when it runs out of room in its stack. This allows the function to perform as well as a recursive implementation for most use-cases without needing allocation or introducing the possibility of stack overflow.
This commit is contained in:
parent
e9889cd25f
commit
274d19575e
1 changed files with 189 additions and 25 deletions
214
lib/std/fs.zig
214
lib/std/fs.zig
Loading…
Add table
Add a link
Reference in a new issue