On Fri, Oct 29, 2021 at 12:15:52AM +0000, Eric Wong wrote:
quoted hunk ↗ jump to hunk
diff --git a/t/test-lib.sh b/t/test-lib.sh
index a291a5d4a2..21f5fab999 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -489,6 +489,13 @@ then
export GIT_PERL_FATAL_WARNINGS
fi
+case $GIT_TEST_FSYNC in
+'')
+ GIT_TEST_FSYNC=0
+ export GIT_TEST_FSYNC
+ ;;
+esac
I don't really have a problem with doing this by default, as it might
help and shouldn't hurt. But I didn't find it actually changed much for
me. Here are timings running the test suite on my machine:
Benchmark 1: GIT_TEST_FSYNC=1 make
Time (mean ± σ): 60.973 s ± 0.158 s [User: 575.914 s, System: 333.243 s]
Range (min … max): 60.731 s … 61.228 s 10 runs
Benchmark 2: GIT_TEST_FSYNC=0 make
Time (mean ± σ): 59.800 s ± 0.094 s [User: 575.151 s, System: 337.111 s]
Range (min … max): 59.643 s … 59.996 s 10 runs
Benchmark 3: GIT_TEST_FSYNC=1 make GIT_TEST_OPTS=--root=/var/ram
Time (mean ± σ): 56.966 s ± 0.066 s [User: 572.353 s, System: 300.808 s]
Range (min … max): 56.874 s … 57.063 s 10 runs
Summary
'GIT_TEST_FSYNC=1 make GIT_TEST_OPTS=--root=/var/ram' ran
1.05 ± 0.00 times faster than 'GIT_TEST_FSYNC=0 make'
1.07 ± 0.00 times faster than 'GIT_TEST_FSYNC=1 make'
So using an actual ram disk provided a much bigger edge for me than just
disabling fsync. This may be because the system is using a decent SSD
for its actual disk. But it may also be because I'm running 32 tests
simultaneously. So fsync introducing latency in tests isn't a big deal;
the bottleneck is CPU and there's always another script ready to run.
Though it is also interesting that the system CPU time is so much lower
in the tmpfs case.
Again, not really an objection, but I don't think this replaces the
"you're better off running the test suite on a RAM disk" wisdom.
-Peff