@ 260812.1

251116.2 · f8029ee7819a11399236c655163425aa08e257fe

darwin/arm64: use the number of perf cores as the default number of workers (#68)

Starting around macOS v15 the parallel performance of the APFS file system appears slightly improved and now the ideal number of fastwalk workers is generally the number of performance cores currently available.

Therefore, this commit changes the default number of workers on darwin/arm64 to be the value of sysctl("hw.perflevel0.physicalcpu") which is the number of currently available performance cores (link to xnu source below).

https://github.com/apple-oss-distributions/xnu/blob/43a90889846e00bfb5cf1d255cdc0a701a1e05a4/bsd/sys/sysctl.h#L1244

reading declarations

Changes to numcpu_darwin_arm64_test.go. All files

numcpu_darwin_arm64_test.go

new file mode 100644@@ -0,0 +1,11 @@+package fastwalk++import "testing"++func TestDarwinNumPerfCores(t *testing.T) {+	n := darwinNumPerfCores()+	// Test that n is reasonable+	if !(0 < n && n < 4096) {+		t.Fatalf("expected a value between 0..4096 got: %d", n)+	}+}