Skip to content

Commit 6333c4b

Browse files
behlendorfsterlingjensen
authored andcommitted
Reduce fletcher4 and raidz benchmark times
During module load time all of the available fetcher4 and raidz implementations are benchmarked for a fixed amount of time to determine the fastest available. Manual testing has shown that this time can be significantly reduced with negligible effect on the final results. This commit changes the benchmark time to 1ms which can reduce the module load time by over a second on x86_64. On an x86_64 system with sse3, ssse3, and avx2 instructions the benchmark times are: Fletcher4 603ms -> 15ms RAIDZ 1,322ms -> 64ms Reviewed-by: Matthew Macy <[email protected]> Reviewed-by: George Melikov <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #11282
1 parent 948c664 commit 6333c4b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

module/zcommon/zfs_fletcher.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ fletcher_4_kstat_addr(kstat_t *ksp, loff_t n)
660660
fletcher_4_fastest_impl.compute_ ## type = src->compute_ ## type; \
661661
}
662662

663-
#define FLETCHER_4_BENCH_NS (MSEC2NSEC(50)) /* 50ms */
663+
#define FLETCHER_4_BENCH_NS (MSEC2NSEC(1)) /* 1ms */
664664

665665
typedef void fletcher_checksum_func_t(const void *, uint64_t, const void *,
666666
zio_cksum_t *);

module/zfs/vdev_raidz_math.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ raidz_math_kstat_addr(kstat_t *ksp, loff_t n)
360360
#define BENCH_D_COLS (8ULL)
361361
#define BENCH_COLS (BENCH_D_COLS + PARITY_PQR)
362362
#define BENCH_ZIO_SIZE (1ULL << SPA_OLD_MAXBLOCKSHIFT) /* 128 kiB */
363-
#define BENCH_NS MSEC2NSEC(25) /* 25ms */
363+
#define BENCH_NS MSEC2NSEC(1) /* 1ms */
364364

365365
typedef void (*benchmark_fn)(raidz_map_t *rm, const int fn);
366366

@@ -410,7 +410,7 @@ benchmark_raidz_impl(raidz_map_t *bench_rm, const int fn, benchmark_fn bench_fn)
410410
t_start = gethrtime();
411411

412412
do {
413-
for (i = 0; i < 25; i++, run_cnt++)
413+
for (i = 0; i < 5; i++, run_cnt++)
414414
bench_fn(bench_rm, fn);
415415

416416
t_diff = gethrtime() - t_start;

0 commit comments

Comments
 (0)