Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should only warn in debug mode and save an additional check here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bevy book recommends compiling bevy with
opt-level=3
. Disabling in debug mode means people who follow those instructions won't see the warning, making it pretty useless.I do agree however that we could avoid checks, and additional binary bloat (log statements add a fairly large number of instructions, without counting the log message) But not sure how. I see some alternatives:
info!
, so that the log can be disabled at compile-time using thelog/max_level_warn
featuredetailed_trace
featurecostly_runtime_checks
and use it as a feature gate for the check.Honestly, I don't prefer any in particular, all have their appeal and tradeoffs, and I don't think it's very important to avoid the check/log here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug checks are still included when compiling with optimizations, as long as you don't switch to release mode.
That said, I don't think it's worth spending too much thought on this check. For regular systems, or exclusive systems that properly reuse their SystemState, command queues will only get dropped when the app exit. The only time this check will be called unnecessarily is if users create a new SystemState every time the system runs, which is a performance pitfall of its own that's going to matter a lot more than this check.