Why polars csvReader in Rust is slower then in python-polars lib?

Hi, I try to read large csv file itno DataFrame via rust-polars lib .

CSV file has 3 mln rows. Via polars-rust it takes about 14s but via polars-python it takes 0.5 sec.
Why "pure" rust is so slow ? Where is my mistake ?

Rust code :

fn example() -> Result<DataFrame> {
   let df =  CsvReader::from_path("3mlnrows.csv")?
            .has_header(true)
            .finish();
   df
}


fn main() {
    if let Err(err) = example() {
        println!("error running example: {}", err);
        process::exit(1);
    }
}

Python code :

import polars as pl 
df = pl.read_csv("3mlnrows.csv")

Thanks in advance for answer .

Obligatory question: Did you run it with --release?

5 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.