mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
perf/factor ~ tune number of stack inlined decomposition values (~1% time improvement)
This commit is contained in:
parent
6eea8c5f30
commit
6a525c950d
1 changed files with 3 additions and 3 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue