Module management and compile time

Hello,

I currently have some broad modules:

A
B
C

Each module contains some other module. For example, A:

A/
  ecs/
  ecs.rs (exposing ecs/)
  gs/ (use ecs)
  gs.rs (exposing gs/)
  lib.rs (exposing A/)
  main.rs (use A)

I noticed my compilation time (cargo run --package A --bin A) are slowly increasing (specially the last step of the compilation. Linkinq?).

My question is: Can I expect a decrease in compilation reorganizing my modules as:

ecs/
  lib.rs (exposing ecs/)
gs/ (use ecs)
  lib.rs (exposing gs/)
A/
  main.rs (use ecs and gs)

Thanks in advance! :slight_smile:

Are you looking for cargo workspaces?

Thanks! :slight_smile:

My answer is maybe.

In my first (aka: current situation) example, A, B and C are combined by a global Cargo.toml:

[workspace]
members = [
    "A", "B", "C"
]

Will I have benefits using more (aka many) workspaces?

Like:

[workspace]
members = [
    "A", "ecs", "gs", "B" "b_foo", "b_bar", "C", etc.
]

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.