File tree 2 files changed +8
-5
lines changed
polars-stream/src/nodes/io_sources/parquet
2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -6,13 +6,13 @@ pub(super) fn no_prefetch(_: &[u8]) {}
6
6
pub ( super ) fn get_memory_prefetch_func ( verbose : bool ) -> fn ( & [ u8 ] ) -> ( ) {
7
7
let memory_prefetch_func = match std:: env:: var ( "POLARS_MEMORY_PREFETCH" ) . ok ( ) . as_deref ( ) {
8
8
None => {
9
- // Sequential advice was observed to provide speedups on Linux.
10
- // ref https://github.com/pola-rs/polars/pull/18152#discussion_r1721701965
11
- #[ cfg( target_os = "linux " ) ]
9
+ // madvise_willneed performed the best on both MacOS on Apple Silicon and Ubuntu on x86-64,
10
+ // using PDS-H query 3 SF=10 after clearing file cache as a benchmark.
11
+ #[ cfg( target_family = "unix " ) ]
12
12
{
13
- madvise_sequential
13
+ madvise_willneed
14
14
}
15
- #[ cfg( not( target_os = "linux " ) ) ]
15
+ #[ cfg( not( target_family = "unix " ) ) ]
16
16
{
17
17
no_prefetch
18
18
}
Original file line number Diff line number Diff line change @@ -82,6 +82,9 @@ pub fn force_populate_read(slice: &[u8]) {
82
82
83
83
#[ cfg( target_family = "unix" ) ]
84
84
fn madvise ( slice : & [ u8 ] , advice : libc:: c_int ) {
85
+ if slice. is_empty ( ) {
86
+ return ;
87
+ }
85
88
let ptr = slice. as_ptr ( ) ;
86
89
87
90
let align = ptr as usize % * PAGE_SIZE ;
You can’t perform that action at this time.
0 commit comments