Skip to content

Conversation

@andriyDev
Copy link
Contributor

Objective

  • Allow the asset processor to run single-threaded so that asset processor tests can run in single-threaded mode too!

Solution

  • Make asset hot reloading use an async channel for events instead of a crossbeam channel (which requires blocking).
  • Have asset processing first find all the assets it wants to process, then join all those processing tasks together.
  • Make the asset processing listening loop await on a stream of async channels instead of "spin-polling" (spin-lock but with polling). This should make asset processing consume less CPU!

Testing

  • Tested asset processing in single threaded! It works!

@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-Assets Load files from disk to use for things like images, models, and sounds O-Web Specific to web (WASM) builds C-Usability A targeted quality-of-life change that makes Bevy easier to use C-Testing A change that impacts how we test Bevy or how users test their apps S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 21, 2025
@andriyDev andriyDev force-pushed the single-threaded-processor branch from f31de94 to cf7f87e Compare October 21, 2025 22:08
@andriyDev andriyDev added the M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide label Oct 21, 2025
@andriyDev andriyDev force-pushed the single-threaded-processor branch from cf7f87e to 0b12215 Compare October 21, 2025 22:13
@alice-i-cecile alice-i-cecile added the O-Embedded Weird hardware and no_std platforms label Oct 21, 2025
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Oct 22, 2025
@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 Oct 22, 2025
Merged via the queue into bevyengine:main with commit 563051d Oct 22, 2025
44 checks passed
mate-h pushed a commit to mate-h/bevy that referenced this pull request Oct 22, 2025
# Objective

- Allow the asset processor to run single-threaded so that asset
processor tests can run in single-threaded mode too!

## Solution

- Make asset hot reloading use an async channel for events instead of a
crossbeam channel (which requires blocking).
- Have asset processing first find all the assets it wants to process,
then join all those processing tasks together.
- Make the asset processing listening loop await on a stream of async
channels instead of "spin-polling" (spin-lock but with polling). This
should make asset processing consume less CPU!

## Testing

- Tested asset processing in single threaded! It works!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Assets Load files from disk to use for things like images, models, and sounds C-Bug An unexpected or incorrect behavior C-Testing A change that impacts how we test Bevy or how users test their apps C-Usability A targeted quality-of-life change that makes Bevy easier to use M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide O-Embedded Weird hardware and no_std platforms O-Web Specific to web (WASM) builds 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