hazptr: Optimize size and speed of hazptr_holder and hazptr_array
Summary: Add hazptr_domain* member to hazptr_rec that never changes. Remove hazptr_domain* member from hazptr_holder. The primary optimization is reducing the sizes of hazptr_holder and hazptr_array from two pointers to one pointer per owned hazard pointer. A secondary advantage is allowing swap of an individual holder in hazptr_array with a hazptr_holder object or an element of another hazptr_array under the conditions: both are either empty or nonempty and if nonempty both hazptrs belong to the same domain. Performance effects on hazptr_holder: + Half the steps for empty construction, move and swap. + One less step in typical construction. - Indirect instead of direct read of pointer to domain, but indirection is likely to be a cache hit if the hazptr was used recently. Measurements: - Faster construction/destruction of hazptr_array<3>. 7.5 ns. instead of 8.5 ns. - No regression in other microbenchmarks. Reviewed By: davidtgoldblatt Differential Revision: D8010395 fbshipit-source-id: 01ffd26f675e57547b1506b777c79d18052ccc65
Showing
Please register or sign in to comment