Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance many_cubes stress test use cases #9596

Merged
merged 1 commit into from
Sep 2, 2023

Conversation

superdump
Copy link
Contributor

@superdump superdump commented Aug 27, 2023

Objective

  • Make many_cubes suitable for testing various parts of the upcoming batching work.

Solution

  • Use argh for CLI.
  • Default to the sphere layout as it is more useful for benchmarking.
  • Add a benchmark mode that advances the camera by a fixed step to render the same frames across runs.
  • Add an option to vary the material data per-instance. The color is randomized.
  • Add an option to generate a number of textures and randomly choose one per instance.
  • Use seeded StdRng for deterministic random numbers.

@superdump superdump force-pushed the many_cubes-enhanced branch 2 times, most recently from 8ad9615 to e4bcc77 Compare August 27, 2023 13:31
@superdump
Copy link
Contributor Author

superdump commented Aug 27, 2023

I see we use fastrand in bevy_asset so I switched to that for reproducible random numbers, just to reduce adding a dependency.

EDIT: Then I saw that bevymark seemed to want to use seeded StdRng and that's built into rand that is already a dependency so I switched to that instead.

@superdump superdump force-pushed the many_cubes-enhanced branch from e4bcc77 to e53a583 Compare August 27, 2023 13:58
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen A-Diagnostics Logging, crash handling, error reporting and performance analysis C-Code-Quality A section of code that is hard to understand or change labels Aug 27, 2023
@alice-i-cecile
Copy link
Member

Swapping to clap for CLI uses is nice: we should probably update our other examples to use it too.

@superdump superdump force-pushed the many_cubes-enhanced branch 3 times, most recently from 047518b to 81988f0 Compare August 29, 2023 20:12
@superdump
Copy link
Contributor Author

Switched to google's argh crate for command line parsing. It's small, has only dependencies that we already have (syn, quote, serde, proc-macro2), and is still derive-based so brings most of the ergonomics we need. FromArgs has a blanket implementation for anything that implements FromStr. This means we have to implement FromStr for enums.

Copy link
Contributor

@robtfm robtfm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks fine and works as intended.

the logic for material selection is quite hard to follow. this is a stress test rather than a "guide" example so maybe not very important, but if i were going to be picky i would say it'd be clearer to initialize the materials upfront, then just use &materials[rng.range(0..materials.len())] in the pbr bundles.

as written, i think if you use 2 textures it will generate a new material for every cube - upfront init would also avoid that.

@superdump
Copy link
Contributor Author

Good call. It evolved as I was adding individual features but I like your suggestion.

Default to the sphere layout as it is more useful for benchmarking.

Add a benchmark mode that advances the camera by a fixed step to render the
same frames across runs.

Add an option to vary the material data per-instance. The color is randomized.

Add an option to generate a number of textures and randomly choose one per
instance.

Use seeded StdRng for deterministic random numbers.
@superdump superdump added this pull request to the merge queue Sep 2, 2023
Merged via the queue into bevyengine:main with commit 40c6b3b Sep 2, 2023
rdrpenguin04 pushed a commit to rdrpenguin04/bevy that referenced this pull request Jan 9, 2024
# Objective

- Make `many_cubes` suitable for testing various parts of the upcoming
batching work.

## Solution

- Use `argh` for CLI.
- Default to the sphere layout as it is more useful for benchmarking.
- Add a benchmark mode that advances the camera by a fixed step to
render the same frames across runs.
- Add an option to vary the material data per-instance. The color is
randomized.
- Add an option to generate a number of textures and randomly choose one
per instance.
- Use seeded `StdRng` for deterministic random numbers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Diagnostics Logging, crash handling, error reporting and performance analysis A-Rendering Drawing game state to the screen C-Code-Quality A section of code that is hard to understand or change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants