commit bbd06a1f05949b10b0f6a248e07d525a3a3a5506
parent a94743f49fab7e9acf6aad0352638c2c4523bd18
Author: Jack Mordaunt <jackmordaunt.dev@gmail.com>
Date: Fri, 18 Sep 2026 11:55:20 -0400
main: let the walker's width be set from the command line
Sweeping it needed a rebuild, which is how a cold cache came to be compared
against a warm one and read as a thirty-fold regression. On System32 the
walker takes 420 ms on one worker and 234 on four, and the same tree cold
takes seconds regardless, because directory metadata that is not in the cache
dominates everything else.
Diffstat:
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/main.odin b/main.odin
@@ -48,6 +48,7 @@ run :: proc() -> int {
target := "C:"
opts: ntfs.Read_Options
+ wcfg: walk.Config
for arg in os.args[1:] {
switch arg {
case "-h", "--help", "/?":
@@ -69,6 +70,10 @@ run :: proc() -> int {
if n, parsed := strconv.parse_int(arg[len("--workers="):]); parsed {
opts.workers = n
}
+ case strings.has_prefix(arg, "--walk-workers="):
+ if n, parsed := strconv.parse_int(arg[len("--walk-workers="):]); parsed {
+ wcfg.workers = n
+ }
case strings.has_prefix(arg, "--chunk="):
if n, parsed := strconv.parse_int(arg[len("--chunk="):]); parsed {
opts.chunk_size = n
@@ -144,7 +149,7 @@ run :: proc() -> int {
scan.node(&t, t.root).name = scan.intern(&rw, strings.trim_suffix(resolved.mount, `\`))
case .Walk:
root := resolved.mount if resolved.root == "" else fmt.tprintf("%s%s", strings.trim_suffix(resolved.mount, `\`), resolved.root)
- if err := walk.scan(root, &t); err != nil {
+ if err := walk.scan(root, &t, wcfg); err != nil {
fmt.eprintfln("error: walking %s: %v", root, err)
return 1
}
diff --git a/walk/walk.odin b/walk/walk.odin
@@ -7,8 +7,7 @@ syscall per directory and learns nothing the OS does not hand it. That makes it
fallback rather than the default, and the yardstick a specialised reader is measured
against.
-Unlike the MFT reader it has no native form of its own. A directory listing is
-already the shape of the tree, so it writes straight into it.
+A directory listing is already the shape of the tree, so it writes straight into it.
*/
package walk