]> git.proxmox.com Git - mirror_zfs.git/commit
Stop wasting time on malloc in snprintf_zstd_header
authorRich Ercolani <214141+rincebrain@users.noreply.github.com>
Fri, 12 Jan 2024 20:17:26 +0000 (15:17 -0500)
committerGitHub <noreply@github.com>
Fri, 12 Jan 2024 20:17:26 +0000 (12:17 -0800)
commit6138af86b317d24f16e1aae71f68ebb5fcb92e46
tree47de7877589cedbe3f5ed422c51e41cfdce65605
parent66670ba9f0f2ee04794f20628be28c46858badc7
Stop wasting time on malloc in snprintf_zstd_header

Profiling zdb -vvvvv on datasets with a lot of zstd blocks, we find
ourselves spending quite a lot of time on malloc/free, because we
allocate a 16M abd each call, and never free it, so we're leaking
16M per call as well.

This seems sub-optimal. So let's just keep the buffer around and
reuse it.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rob Norris <robn@despairlabs.com>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #15721
cmd/zdb/zdb.c