]> git.proxmox.com Git - mirror_zfs.git/commit
AVL: Remove obsolete branching optimizations
authorAlexander Motin <mav@FreeBSD.org>
Thu, 9 Jun 2022 22:27:36 +0000 (18:27 -0400)
committerGitHub <noreply@github.com>
Thu, 9 Jun 2022 22:27:36 +0000 (15:27 -0700)
commitfc5200aa9b345972fc1b99869b03a373090b84c7
tree86698db5162a8f62869b546e215ead72914556eb
parentcdeb98a116a3b31558d6d7cb861b0cbd992a27cc
AVL: Remove obsolete branching optimizations

Modern Clang and GCC can successfully implement simple conditions
without branching with math and flag operations.  Use of arrays for
translation no longer helps as much as it was 14+ years ago.

Disassemble of the code generated by Clang 13.0.0 on FreeBSD 13.1,
Clang 14.0.4 on FreeBSD 14 and GCC 10.2.1 on Debian 11 with this
change still shows no branching instructions.

Profiling of CPU-bound scan stage of sorted scrub shows reproducible
reduction of time spent inside avl_find() from 6.52% to 4.58%.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #13540
module/avl/avl.c