Skip to content

Refactor check_light_mesh_visibility for performance #1#13905

Merged
alice-i-cecile merged 5 commits intobevyengine:mainfrom
re0312:split-light
Jun 18, 2024
Merged

Refactor check_light_mesh_visibility for performance #1#13905
alice-i-cecile merged 5 commits intobevyengine:mainfrom
re0312:split-light

Conversation

@re0312
Copy link
Copy Markdown
Contributor

@re0312 re0312 commented Jun 18, 2024

Objective

Solution

  • split check_light_mesh_visibility into check_dir_light_mesh_visibility and check_point_light_mesh_visibility for better review

@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Performance A change motivated by improving speed, memory usage or compile times C-Code-Quality A section of code that is hard to understand or change S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jun 18, 2024
re0312 added 2 commits June 18, 2024 09:31
This reverts commit 6ce8c81.
check_light_mesh_visibility
(
check_dir_light_mesh_visibility,
check_point_light_mesh_visibility,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do these systems need to be ordered relative to each other?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It should not be necessary. The main reason for splitting the system is that in subsequent PRs, we hope they can be automatically parallelized by the bevy's scheduler.

Copy link
Copy Markdown
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

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

I've checked this over, and the refactoring / splitting appears to be done correctly. The core idea for why this should be done also makes sense to me :)

@alice-i-cecile alice-i-cecile requested a review from IceSentry June 18, 2024 01:46
@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jun 18, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jun 18, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 18, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jun 18, 2024
Merged via the queue into bevyengine:main with commit 91cd84f Jun 18, 2024
github-merge-queue bot pushed a commit that referenced this pull request Jun 26, 2024
# Objective

- Second part of #13900 
- based on #13905 

## Solution

- check_dir_light_mesh_visibility defers setting the entity's
`ViewVisibility `so that Bevy can schedule it to run in parallel with
`check_point_light_mesh_visibility`.

- Reduce HashMap lookups for directional light checking as much as
possible

- Use `par_iter `to parallelize the checking process within each system.

---------

Co-authored-by: Kristoffer Søholm <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Code-Quality A section of code that is hard to understand or change C-Performance A change motivated by improving speed, memory usage or compile times S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants