AVL: Remove obsolete branching optimizations
Update from OpenZFS (commit fc5200aa9b345972fc1b99869b03a373090b84c7)
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 <firstname.lastname@example.org> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored-By: iXsystems, Inc. Closes #13540
Testing done: bjuild/install/boot, running zpool scrub with this update applied.
Updated by Electric Monk 8 days ago
- Status changed from In Progress to Closed
- % Done changed from 90 to 100
commit 028c45646327b08802a29b76d1abea8907a57f17 Author: Alexander Motin <mav@FreeBSD.org> Date: 2022-06-28T17:01:03.000Z 14752 AVL: Remove obsolete branching optimizations Reviewed by: Andy Fiddaman <email@example.com> Reviewed by: Jason King <firstname.lastname@example.org> Reviewed by: Toomas Soome <email@example.com> Approved by: Dan McDonald <firstname.lastname@example.org>