CodSpeedHQ / codspeed-rust

Rust crates to create CodSpeed benchmarks
https://codspeed.io
Apache License 2.0
24 stars 9 forks source link

Allow selecting different profiles #48

Closed Dekker1 closed 2 months ago

Dekker1 commented 3 months ago

Currently the cargo codspeed build command requests the release profile: https://github.com/CodSpeedHQ/codspeed-rust/blob/ac3dae836b115cb972ce3d5f31cb7e55cb69cdd7/crates/cargo-codspeed/src/build.rs#L36. However, there is a standard bench profile that is used by cargo bench. Note that this bench by default is the same as the release profile, but can be overwritten by users to enable different build options for benchmarking.

I was hoping to use this profile as I would like to set debug = true to receive better traces in CodSpeed, but would not like to do this for the release profile. At the moment there doesn't seem to be a way to override the build profile that is used by the cargo codspeed build command.

art049 commented 2 months ago

It would definitely make sense to allow custom profiles. However, if I remember correctly, it's not possible to use the bench profile with a custom benchmarking process. I'll give it a try and eventually document that if that's not working.

Edit: in the end it seem possible to use the bench profile and it works perfectly fine

art049 commented 2 months ago

I was hoping to use this profile as I would like to set debug = true to receive better traces in CodSpeed, but would not like to do this for the release profile. At the moment there doesn't seem to be a way to override the build profile that is used by the cargo codspeed build command.

You shouldn't need to add the debug configuration to your release profile manually since we pass it to rustc. So normally you should have the debug symbols already in your codspeed builds. https://github.com/CodSpeedHQ/codspeed-rust/blob/f91abc79aa86e1def9084fcee78236bcb5eee96c/crates/cargo-codspeed/src/app.rs#L59

Dekker1 commented 2 months ago

Thank you for the quick work! After making the issue, I did indeed find that it was my stripping settings, and not the debug = true settings that were the problem. Either way the new changes will resolve the problem 😄