mirror of
https://github.com/uutils/coreutils
synced 2024-09-06 16:03:44 +00:00
perf/factor ~ tune number of stack inlined decomposition values (~1% time improvement)
This commit is contained in:
parent
6eea8c5f30
commit
6a525c950d
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue