• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by John Dev


11 Jan, 2025

Updated at 26 Jan, 2025

Optimizing Incremental Compilation in a Hexagonal Architecture Project with Rust

I wrote a big (but not so complex) project using hexagonal architecture (similar to Clean and Scalable Architecture for Web Applications in Rust).

So my project is like:

- src/crates/

    - invoicing

        - models

            - very
            - long
            - list
            - of
            - files
            - here

        - services

            - very
            - long
            - list
            - of
            - files
            - here

        - adapters

            - very
            - long
            - list
            - of
            - files
            - here

        - ports

    - payments

    - uploads

Everything works great.

But I'm not happy because each time I edit one single file in services or adapters it recompiles all the invoicing crates and everything that depends on it (but not payments nor uploads).

The times for incremental compilation (the time I need to wait after each "save" command on a file during a cargo watch run ) are very slow.

QUESTIONS:

  1. Is there another code structure to avoid the long incremental build times after each "save" command?

  2. Is there a way to avoid compilation at all using something like an interpreter for Rust code?

    I mean, the code architecture is already there, I'm only editing business logic in very few files or adding new of them. I don't care about --release build times: I just want to try the changes on my local PC before deploying them.

    Is there for example a WASM interpreter for Rust code? Such as to avoid compilation at all?

1 post - 1 participant

Read full topic