taiki-e / cargo-llvm-cov

Cargo subcommand to easily use LLVM source-based code coverage (-C instrument-coverage).
Apache License 2.0
858 stars 57 forks source link

Performance level expecations #371

Closed dpc closed 1 month ago

dpc commented 1 month ago

I have a test suite and most tests seems to get mildly slower (compared to a normal build), but there are some that seem to take 10x more to execute. I think what is happening is that they spawn a lot of threads (mocked servers) in the background, and somehow all that things being traced at the same time, increases the latencies everywhere. But it's just a guess.

So my question is more general: I'm trying to get an intuition w.r.t how much slower should things get when running in cargo-llvm-cov build and how to think about where slowdown is expected to be happening.

taiki-e commented 1 month ago

In my understanding, performance differences are mainly due to code inserted by rustc/LLVM for coverage measurement, so it is better to ask questions in those repositories.

The slower test with a large number of threads is consistent with my understanding because atomic instructions are used to synchronize the counters.