From 6a525c950db0cc38007c14cfbee932a2e52048c9 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Thu, 8 Oct 2020 21:13:26 -0500 Subject: [PATCH] perf/factor ~ tune number of stack inlined decomposition values (~1% time improvement) --- src/uu/factor/src/factor.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index 3cf9783a2..524ee9381 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -20,9 +20,9 @@ type Exponent = u8; struct Decomposition(SmallVec<[(u64, Exponent); NUM_FACTORS_INLINE]>); // The number of factors to inline directly into a `Decomposition` object. -// As a consequence of the Erdős–Kac theorem, the average number of prime -// factors of integers < 10²⁵ ≃ 2⁸³ is 4, so we can use that value. -const NUM_FACTORS_INLINE: usize = 4; +// As a consequence of the Erdős–Kac theorem, the average number of prime factors +// of integers < 10²⁵ ≃ 2⁸³ is 4, so we can use a slightly higher value. +const NUM_FACTORS_INLINE: usize = 5; impl Decomposition { fn one() -> Decomposition {