RustQuant icon indicating copy to clipboard operation
RustQuant copied to clipboard

Decrease compile time.

Open avhz opened this issue 2 years ago • 8 comments

Compile time increased quite substantially after adding Polars as a dependency. Should look into reducing the compile time a bit if possible.

avhz avatar May 25 '23 11:05 avhz

Have made polars crate part of an opt-in feature.

avhz avatar Jun 19 '23 16:06 avhz

we can remove https://github.com/avhz/RustQuant/blob/634735dd5d860af26f5e31091aca44ee69ea2430/Cargo.toml#L45C16-L45C16

and edit data = ["dep:polars/default"] https://github.com/avhz/RustQuant/blob/634735dd5d860af26f5e31091aca44ee69ea2430/Cargo.toml#L56

Harshal662 avatar Jun 24 '23 17:06 Harshal662

The way I have it currently reduces the number of dependencies compiled from 400+ to around 270-280.

Are you saying we should remove optional = true and change polars to a default feature ? This would increase the dependencies compiled to 400+ again wouldn't it ?

avhz avatar Jun 25 '23 12:06 avhz

Ohh My bad we can keep it as true and data = [] ( empty) , the data feature is disabled by default, meaning Polars will not be included in the compilation process unless explicitly enabled using the --features data flag or specifying features = ["data"] in the Cargo.toml file.

Harshal662 avatar Jun 25 '23 14:06 Harshal662

But polars is already not included unless data is specified as a feature.

Why do you want to have data = [] instead of data = ["dep:polars"] ?

avhz avatar Jun 25 '23 14:06 avhz

Hello! Came here by the first good issue tag.

Is this still a problem? Maybe separate the project into smaller crates could improve the compile time

kelvincesar avatar Sep 14 '24 17:09 kelvincesar

@kelvincesar thanks for the comment :) I have considered doing this but am worried about running into issues with the orphan rules.

avhz avatar Oct 01 '24 22:10 avhz

@avhz you're right, that can be a problem. In this case we would have to create new types around the existing ones plus replicate their methods (https://doc.rust-lang.org/book/ch19-03-advanced-traits.html#using-the-newtype-pattern-to-implement-external-traits-on-external-types). I don't know if this make sense

kelvincesar avatar Oct 02 '24 14:10 kelvincesar