Why using ``] test pakage`` recompiles the package again?

There’s no good way around it. Bounds-checking is implemented in the compiler: when it’s on, it generates different code than when it’s off. Since Julia 1.9 saves the compiled code, the mode you compile in matters: you can’t just change the mode after compilation is complete.

But that means you need to compile twice: once with bounds-checking on, and once with bounds-checking off. Now, we could do that up-front, but that would ~double the compilation time in many cases where the user never has any intention of running the tests. So better is to precompile once with default settings, and then when running tests we have to recompile (if the up-to-date source code has not already been compiled with --check-bounds=yes).

Compiling C is little different: want both -O0 and -O3? You have to compile twice.

If the amount of compilation time is annoying, and if you’re using SnoopPrecompile, consider turning it off in your local package dev environment: PSA for SnoopPrecompile: turning off extra workload for specific packages - #5 by tim.holy