scarb icon indicating copy to clipboard operation
scarb copied to clipboard

only build the required files when running a few tests

Open moodysalem opened this issue 1 year ago • 7 comments

Problem

when i run a single test via scarb test -f ... it takes 5-10 seconds just to run

i suspect it's re-building all the code just to run a single test

my repo is quite large and splitting it up is impractical, so i'd like it if scarb only built the required files

Proposed Solution

only build the required files, so it runs faster

Notes

n/a

moodysalem avatar Aug 20 '23 12:08 moodysalem

or ideally add a watch mode that only runs the changed tests and i can just fix my tests in real time

moodysalem avatar Aug 20 '23 13:08 moodysalem

Hmm, this suggestion sounds neat, but I can't see how we can implement this without having incremental compilation in Cairo compiler itself. That's because the compiler is indeed fully rebuilding everything because it is not capable of saving a part of work and reusing it later, it just takes a hash map of package name → source path as sole input.

The only much more coarse thing we can do with Scarb only is that with #380 being done, we could only recompile one of tests/* files whenever it's changed, instead of recompiling everything. But this won't help a lot I think

mkaput avatar Aug 22 '23 08:08 mkaput

it takes 45 seconds just to compile so i can run a single test in the ekubo contracts repo right now. i'm used to it but this feels very high priority for codebases with significant amount of complexity. is there any other solution?

moodysalem avatar Oct 07 '23 12:10 moodysalem

We have identified a regression in Scarb 2.3.0-rc0, which we will fix in 2.3.0-rc1, to be released in couple of days. This should help with your 45s build time situation.

Other than that, we can only push Cairo team to prioritise this work.

mkaput avatar Oct 07 '23 13:10 mkaput

Hello dear @mkaput , I just followed this thread and I am facing the same situation as @moodysalem. When performing tests on large codebases its impractical to wait for a considerably long compilation time. Idk in which stage of improving this you are now as I saw your last comment was to push Cairo team for it.

Thanks a lot in advance!,

fvelazquez-X avatar Apr 04 '24 14:04 fvelazquez-X

Hey @fvelazquez-X! This is still a low-priority thing upstream. We've been discussing this recently and there are no updates on this front.

We are not saying this is not important. We agree it is! But the Cairo team identifies more critical features to implement now.

mkaput avatar Apr 08 '24 07:04 mkaput

Update: As for now, incremental compilation is not planned to be worked on.

mkaput avatar Apr 18 '24 16:04 mkaput