bheisler / iai

Experimental one-shot benchmarking/profiling harness for Rust
Apache License 2.0
578 stars 23 forks source link

iai doesn't use the correct target dir in multi-crate workspaces or respect --target-dir #19

Open tsheinen opened 3 years ago

tsheinen commented 3 years ago

iai uses a hardcoded relative path "target/iai/cachegrind.out.{}" for outputs which isn't the correct target directory in some cases. Particularly when you are using a multi-crate workspace (which uses a shared target directory for all crates) and when cargo bench's --target-dir argument is set. I was going to just PR a fix (and I'm happy to do so if we conclude a good way to do it), but I couldn't find an elegant way to fix it. The best I've thought of so far is popping three (release, deps, and the iai- binary) segments off the binary path but I'm not confident that is correct in all cases.