perf/factor ~ tune number of stack inlined decomposition values (~1% time improvement)

This commit is contained in:
Roy Ivy III 2020-10-08 21:13:26 -05:00
parent 6eea8c5f30
commit 6a525c950d

View file

@ -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ősKac 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ősKac 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 {