polars-utils 0.53.0

Private utils for the Polars DataFrame library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::num::NonZeroUsize;
use std::sync::OnceLock;

pub fn get_ideal_morsel_size() -> NonZeroUsize {
    return *IDEAL_MORSEL_SIZE.get_or_init(|| {
        std::env::var("POLARS_IDEAL_MORSEL_SIZE")
            .map(|x| {
                x.parse::<NonZeroUsize>()
                    .unwrap_or_else(|_| panic!("invalid value for POLARS_IDEAL_MORSEL_SIZE: {x}"))
            })
            .unwrap_or(const { NonZeroUsize::new(100_000).unwrap() })
    });

    static IDEAL_MORSEL_SIZE: OnceLock<NonZeroUsize> = OnceLock::new();
}