# Use \`iterateAssumeFirstIteration\` in \`Walker.next\` to avoid unnecessary lseek calls · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/2f188290e203780752597b0263581590af3a69b2)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 2f188290e203780752597b0263581590af3a69b2

Requested commit: 2f188290e203780752597b0263581590af3a69b2

Commit: 2f188290e203780752597b0263581590af3a69b2

Tree: ebab0d11aa6a249ef05337725f57d868e848a75c

Author: Ryan Liptak

Committer: Ryan Liptak

## Message

```
Use `iterateAssumeFirstIteration` in `Walker.next` to avoid unnecessary lseek calls

Since we are opening each directory for iteration, we know that we don't need to reset the cursor's directory before iterating. Using `iterateAssumeFirstIteration` skips the cursor resetting which eliminates an `lseek` syscall for every directory opened on non-Windows platforms.

This doesn't seem to actually matter much for performance (1.01 ± 0.02 times faster when walking /home/ on my system) but avoiding unnecessary syscalls is always nice anyway.

```

## Parents

- [00ff65357666a7ec161d6e80c92be2ccc79e3638](https://git.cafe/gitcafe/zig/commit/00ff65357666a7ec161d6e80c92be2ccc79e3638?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/2f188290e203780752597b0263581590af3a69b2?format=markdown)
