-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Remove or shrink bevy_utils #11478
Comments
Yes please: I want this crate eliminated! |
I think we may want to spin up new crates in the Bevy org for some of the stand-alone utilities. @cart, would that make sense to you? Things like the That said, I know you're reluctant about increasing crate number, just because it's a popular misguided punching bag for "dependency bloat". |
I'm curious whats the compile-time performance penalty of switching between compiling different crates vs. the compile-time performance penalty of compiling unused parts of a crate. |
|
|
Use `TypeIdMap<T>` instead of `HashMap<TypeId, T>` - ~~`TypeIdMap` was in `bevy_ecs`. I've kept it there because of #11478~~ - ~~I haven't swapped `bevy_reflect` over because it doesn't depend on `bevy_ecs`, but I'd also be happy with moving `TypeIdMap` to `bevy_utils` and then adding a dependency to that~~ - ~~this is a slight change in the public API of `DrawFunctionsInternal`, does this need to go in the changelog?~~ ## Changelog - moved `TypeIdMap` to `bevy_utils` - changed `DrawFunctionsInternal::indices` to `TypeIdMap` ## Migration Guide - `TypeIdMap` now lives in `bevy_utils` - `DrawFunctionsInternal::indices` now uses a `TypeIdMap`. --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Use `TypeIdMap<T>` instead of `HashMap<TypeId, T>` - ~~`TypeIdMap` was in `bevy_ecs`. I've kept it there because of bevyengine#11478~~ - ~~I haven't swapped `bevy_reflect` over because it doesn't depend on `bevy_ecs`, but I'd also be happy with moving `TypeIdMap` to `bevy_utils` and then adding a dependency to that~~ - ~~this is a slight change in the public API of `DrawFunctionsInternal`, does this need to go in the changelog?~~ ## Changelog - moved `TypeIdMap` to `bevy_utils` - changed `DrawFunctionsInternal::indices` to `TypeIdMap` ## Migration Guide - `TypeIdMap` now lives in `bevy_utils` - `DrawFunctionsInternal::indices` now uses a `TypeIdMap`. --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
# Objective Reduce the size of `bevy_utils` (#11478) ## Solution Move `EntityHash` related types into `bevy_ecs`. This also allows us access to `Entity`, which means we no longer need `EntityHashMap`'s first generic argument. --- ## Changelog - Moved `bevy::utils::{EntityHash, EntityHasher, EntityHashMap, EntityHashSet}` into `bevy::ecs::entity::hash` . - Removed `EntityHashMap`'s first generic argument. It is now hardcoded to always be `Entity`. ## Migration Guide - Uses of `bevy::utils::{EntityHash, EntityHasher, EntityHashMap, EntityHashSet}` now have to be imported from `bevy::ecs::entity::hash`. - Uses of `EntityHashMap` no longer have to specify the first generic parameter. It is now hardcoded to always be `Entity`.
# Objective Reduce the size of `bevy_utils` (bevyengine/bevy#11478) ## Solution Move `EntityHash` related types into `bevy_ecs`. This also allows us access to `Entity`, which means we no longer need `EntityHashMap`'s first generic argument. --- ## Changelog - Moved `bevy::utils::{EntityHash, EntityHasher, EntityHashMap, EntityHashSet}` into `bevy::ecs::entity::hash` . - Removed `EntityHashMap`'s first generic argument. It is now hardcoded to always be `Entity`. ## Migration Guide - Uses of `bevy::utils::{EntityHash, EntityHasher, EntityHashMap, EntityHashSet}` now have to be imported from `bevy::ecs::entity::hash`. - Uses of `EntityHashMap` no longer have to specify the first generic parameter. It is now hardcoded to always be `Entity`.
Regarding the |
# Objective Make bevy_utils less of a compilation bottleneck. Tackle #11478. ## Solution * Move all of the directly reexported dependencies and move them to where they're actually used. * Remove the UUID utilities that have gone unused since `TypePath` took over for `TypeUuid`. * There was also a extraneous bytemuck dependency on `bevy_core` that has not been used for a long time (since `encase` became the primary way to prepare GPU buffers). * Remove the `all_tuples` macro reexport from bevy_ecs since it's accessible from `bevy_utils`. --- ## Changelog Removed: Many of the reexports from bevy_utils (petgraph, uuid, nonmax, smallvec, and thiserror). Removed: bevy_core's reexports of bytemuck. ## Migration Guide bevy_utils' reexports of petgraph, uuid, nonmax, smallvec, and thiserror have been removed. bevy_core' reexports of bytemuck's types has been removed. Add them as dependencies in your own crate instead.
…e#12313) # Objective Make bevy_utils less of a compilation bottleneck. Tackle bevyengine#11478. ## Solution * Move all of the directly reexported dependencies and move them to where they're actually used. * Remove the UUID utilities that have gone unused since `TypePath` took over for `TypeUuid`. * There was also a extraneous bytemuck dependency on `bevy_core` that has not been used for a long time (since `encase` became the primary way to prepare GPU buffers). * Remove the `all_tuples` macro reexport from bevy_ecs since it's accessible from `bevy_utils`. --- ## Changelog Removed: Many of the reexports from bevy_utils (petgraph, uuid, nonmax, smallvec, and thiserror). Removed: bevy_core's reexports of bytemuck. ## Migration Guide bevy_utils' reexports of petgraph, uuid, nonmax, smallvec, and thiserror have been removed. bevy_core' reexports of bytemuck's types has been removed. Add them as dependencies in your own crate instead.
# Objective - Attempts to solve two items from #11478. ## Solution - Moved `intern` module from `bevy_utils` into `bevy_ecs` crate and updated all relevant imports. - Moved `label` module from `bevy_utils` into `bevy_ecs` crate and updated all relevant imports. --- ## Migration Guide - Replace `bevy_utils::define_label` imports with `bevy_ecs::define_label` imports. - Replace `bevy_utils::label::DynEq` imports with `bevy_ecs::label::DynEq` imports. - Replace `bevy_utils::label::DynHash` imports with `bevy_ecs::label::DynHash` imports. - Replace `bevy_utils::intern::Interned` imports with `bevy_ecs::intern::Interned` imports. - Replace `bevy_utils::intern::Internable` imports with `bevy_ecs::intern::Internable` imports. - Replace `bevy_utils::intern::Interner` imports with `bevy_ecs::intern::Interner` imports. --------- Co-authored-by: James Liu <contact@jamessliu.com>
|
Regarding stuff like |
About |
did |
I believe it did. You can view the draft migration guide here. |
|
# Objective Reduce the size of `bevy_utils` (bevyengine/bevy#11478) ## Solution Move `EntityHash` related types into `bevy_ecs`. This also allows us access to `Entity`, which means we no longer need `EntityHashMap`'s first generic argument. --- ## Changelog - Moved `bevy::utils::{EntityHash, EntityHasher, EntityHashMap, EntityHashSet}` into `bevy::ecs::entity::hash` . - Removed `EntityHashMap`'s first generic argument. It is now hardcoded to always be `Entity`. ## Migration Guide - Uses of `bevy::utils::{EntityHash, EntityHasher, EntityHashMap, EntityHashSet}` now have to be imported from `bevy::ecs::entity::hash`. - Uses of `EntityHashMap` no longer have to specify the first generic parameter. It is now hardcoded to always be `Entity`.
Some thoughts on Do we really need this to exist in All my answers to these questions are "No" right now, so I'll appreciate any counter arguments to them. |
My arguments to include it:
From my perspective, that means we need to make this (publicly) available somewhere. In the interest of removing bevy_utils, I could be convinced to move it into |
Could we ship a tiny crate for it? It seems genuinely useful to the ecosystem, and I think that dramatically more people will use it standalone. |
I'm all in for a I could work on any of these items FWIW, moving it temporarily to the asset crate and/or creating a new crate, but I'd need some support for the latter as I won't have the permissions to create a new repo within the org and publish a crate from it. |
I'm on board with this, and have @cart's blessing. I'm on vacation this week, but please prompt me to get you set up on August 26, 2024. |
Should make for a very simple pr (I can open it), and it might reduce final bundle size since we arn't shipping an extra implementation, but are using the same implementation from std most devs already use.
For a future bevy with a nice modding system, I feel like the protection offered against HashDoS is a good thing... but I'm not entirely sure. @mintlu8 Are there benchmarks for performance of |
The default hasher for std library seems to be
|
Thanks @hymm, I stand corrected. So we don't want to use |
This is an old benchmark for https://medium.com/@tprodanov/benchmarking-non-cryptographic-hash-functions-in-rust-2e6091077d11
|
Side note: tracing re-export can probably just be removed since |
Note that |
Addressing The module exists to support an aesthetic preference. It can be removed easily (although it is a LOT of simple edits), but this won't happen unless a decision is first be made by leadership to stop preferring " |
# Objective - Goal is to minimize bevy_utils #11478 ## Solution - Move the file short_name wholesale into bevy_reflect ## Testing - Unit tests - CI ## Migration Guide - References to `bevy_utils::ShortName` should instead now be `bevy_reflect::ShortName`. --------- Co-authored-by: François Mockers <francois.mockers@vleue.com>
Given how sensitive people are to "init ergonomics", I'm still very biased toward keeping and preferring I don't like putting
|
But there's rust-lang/rfcs#1995 which might help in the future... |
|
What problem does this solve or what need does it fill?
bevy_utils
is a collection of unrelated utilities for Bevy. Utility modules/classes/libraries are generally frowned upon in the programming community since they are most likely a sign of poor organization.What solution would you like?
Move
bevy_utils
's contents into existing bevy crates or into separate crates.Long list of what to do with each item in
bevy_utils
BoxedFuture
could probably be removed since async in traits were added in Rust 1.75HashMap
related stuff: no idea where to put that.EntityHash
related types intobevy_ecs
#11498OnDrop
could be its own cratetracing
related stuff: put inbevy_log
once
related stuff: I would put it inbevy_log
, but this could cause some issues (see move once from bevy_log to bevy_utils, to allow for it's use in bevy_ecs #11419)get_short_name
: put inbevy_reflect
SyncCell
: usestd::sync::Exclusive
when stabilized (Tracking Issue forExclusive
rust-lang/rust#98407)SyncUnsafeCell
: usestd::cell::SyncUnsafeCell
when stablized (Tracking Issue for SyncUnsafeCell rust-lang/rust#95439)generate_composite_uuid
: Maybe contribute this to theuuid
crate?label
module: Sounds like abevy_reflect
thing but isn't actually used anywhere there so idkInterned
: put inbevy_ecs
futures
module: only used inbevy_render
, so put it there.FloatOrd
: could be its own cratedefault
: Could be its own crate (Thedefault
crate already exists, so maybe we should use that)CowArc
: Could be its own crateThe text was updated successfully, but these errors were encountered: