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

Replace for item in query with query.for_each #528

Closed
rj00a opened this issue Sep 18, 2023 · 5 comments
Closed

Replace for item in query with query.for_each #528

rj00a opened this issue Sep 18, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@rj00a
Copy link
Member

rj00a commented Sep 18, 2023

Describe the problem related to your feature request.

Query::for_each is known to be significantly faster than Query::iter due to rustc failing to optimize properly.

What solution would you like?

Replace all uses of .iter()/.iter_mut()/&/&mut with .for_each/.for_each_mut where feasible.

What alternative(s) have you considered?

Don't do this since it could be considered a temporary rustc failure that will be fixed in the future. (But when will it be fixed?)

Additional context

Not sure if there's an open bevy issue for this.

@rj00a rj00a added the enhancement New feature or request label Sep 18, 2023
@rj00a
Copy link
Member Author

rj00a commented Sep 18, 2023

rust-lang/rust#104914

Yes, that's a long-known issue (see the blog post linked previously) but there aren't any good plans how to fix it.

@rj00a
Copy link
Member Author

rj00a commented Sep 18, 2023

bevyengine/bevy#6773 plans to deprecate Query::for_each.

@Milo123459
Copy link

as bevy is planning to deprecate it, should we not just leave it as is as it is an upstream issue.

@rj00a
Copy link
Member Author

rj00a commented Sep 29, 2023

Yeah, I would rather not make any changes until bevyengine/bevy#6773 comes to a conclusion.

@Milo123459
Copy link

yeah, also i presume some members of the bevy community are going to see the upstream issue and can hopefully help out to fix it upstream (in the rust repo.)

@rj00a rj00a closed this as not planned Won't fix, can't repro, duplicate, stale Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants