dimforge / rapier

2D and 3D physics engines focused on performance.
https://rapier.rs
Apache License 2.0
3.92k stars 244 forks source link

Headless Testbed with Metrics? #702

Closed JulianKnodt closed 1 month ago

JulianKnodt commented 1 month ago

Hey, I'm using Rapier to evaluate the performance of collider meshes, and have been using the testbed app. I was wondering if there's an easy way to run the testbed app without graphics and to get the FPS at each frame programmatically? I checked the docs and didn't look like there was an easy way, but wanted to ask before reimplementing part of it.

Thanks!

Vrixyz commented 1 month ago

There is a benchmark mode for the testbed, which you can enable by passing --bench, like cargo run --release --bin all_benchmarks3 -- --bench --example boxes ; which will output a csv of frame durations in milliseconds

JulianKnodt commented 1 month ago

Neato, this does what I hope for, but it also is hardcoded to 1000 frames (here). It also seems the help message doesn't actually show that --bench is an option. Is that something that would be amenable to be changed in a PR?

As a side note, I originally had a clap::Parser in the example file, and it seems because they are unaware of each other it's a bit annoying to handle nested args. I added an ignored --bench argument to the clap parser which seemed to work alright.

Vrixyz commented 1 month ago

Indeed, the arguments handling is not great 🫂

Pull requests for improving the help message and/or the hardcoded args handling are welcome!