Skip to content

Conversation

makspll
Copy link
Owner

@makspll makspll commented Aug 23, 2025

Summary

Instead of depending on the bevy workspace, we can instead rely on the individual subcrates. This let's us:

  • Reduce the amount of unnecessary features / crates
  • Decouple compilation, so parallelization can happen earlier on in the process
  • Centralizes all dependencies and features in the workspace toml
  • If bevy has features you can't access from top level, we are no longer affected

Migration Guide

If you were relying on BMS enabling some features in Bevy crates, your builds might be pulling in less features than you expect. Ensure you explicitly select all features you need from bevy. BMS will now only pull in strictly necessary features and crates from bevy

Copy link

semanticdiff-com bot commented Aug 23, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/bevy_mod_scripting_derive/src/derive/get_type_dependencies.rs  85% smaller
  crates/bevy_mod_scripting_core/src/docgen/info.rs  85% smaller
  crates/bevy_mod_scripting_core/src/bindings/function/type_dependencies.rs  82% smaller
  crates/testing_crates/test_utils/src/test_plugin.rs  79% smaller
  crates/testing_crates/script_integration_test_harness/src/test_functions.rs  78% smaller
  crates/bevy_mod_scripting_core/src/bindings/schedule.rs  77% smaller
  crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs  76% smaller
  crates/bevy_mod_scripting_core/src/script/mod.rs  74% smaller
  crates/bevy_mod_scripting_core/src/bindings/access_map.rs  73% smaller
  crates/bevy_mod_scripting_core/src/bindings/globals/mod.rs  71% smaller
  crates/bevy_mod_scripting_core/src/error.rs  67% smaller
  crates/bevy_mod_scripting_core/src/docgen/typed_through.rs  66% smaller
  crates/bevy_mod_scripting_core/src/event.rs  65% smaller
  crates/bevy_mod_scripting_core/src/runtime.rs  64% smaller
  crates/bevy_mod_scripting_core/src/extractors.rs  63% smaller
  crates/bevy_mod_scripting_core/src/bindings/function/arg_meta.rs  60% smaller
  crates/bevy_mod_scripting_core/src/bindings/reference.rs  60% smaller
  crates/bevy_mod_scripting_core/src/bindings/allocator.rs  58% smaller
  crates/languages/bevy_mod_scripting_rhai/src/lib.rs  58% smaller
  benches/benchmarks.rs  58% smaller
  crates/bevy_mod_scripting_core/src/bindings/globals/core.rs  58% smaller
  crates/bevy_mod_scripting_core/src/bindings/script_system.rs  56% smaller
  crates/bevy_mod_scripting_core/src/script/script_context.rs  56% smaller
  crates/bevy_mod_scripting_core/src/bindings/script_component.rs  52% smaller
  crates/ladfile_builder/src/lib.rs  49% smaller
  crates/testing_crates/script_integration_test_harness/src/lib.rs  49% smaller
  crates/testing_crates/test_utils/src/test_data.rs  49% smaller
  crates/bevy_mod_scripting_core/src/bindings/script_value.rs  48% smaller
  crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs  47% smaller
  crates/bevy_mod_scripting_core/src/reflection_extensions.rs  46% smaller
  crates/bevy_mod_scripting_core/src/bindings/function/namespace.rs  46% smaller
  crates/bevy_mod_scripting_core/src/commands.rs  40% smaller
  crates/bevy_mod_scripting_core/src/bindings/query.rs  40% smaller
  crates/bevy_mod_scripting_functions/src/core.rs  39% smaller
  crates/testing_crates/script_integration_test_harness/src/scenario.rs  39% smaller
  crates/bevy_system_reflection/src/lib.rs  37% smaller
  crates/languages/bevy_mod_scripting_lua/src/lib.rs  33% smaller
  crates/bevy_mod_scripting_core/src/bindings/world.rs  32% smaller
  src/lib.rs  28% smaller
  crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs  27% smaller
  xtask/src/main.rs  21% smaller
  crates/bevy_mod_scripting_core/src/script/context_key.rs  20% smaller
  crates/bevy_mod_scripting_core/src/handler.rs  16% smaller
  crates/bevy_mod_scripting_core/src/context.rs  10% smaller
  crates/bevy_mod_scripting_core/src/lib.rs  5% smaller
  crates/bevy_mod_scripting_core/src/asset.rs  4% smaller
  crates/bevy_mod_scripting_core/src/bindings/function/from.rs  2% smaller
  .gitattributes Unsupported file format
  Cargo.toml Unsupported file format
  codegen/templates/footer.tera Unsupported file format
  codegen/templates/header.tera Unsupported file format
  codegen/templates/import.tera Unsupported file format
  codegen/templates/macros.tera Unsupported file format
  crates/bevy_mod_scripting_core/Cargo.toml Unsupported file format
  crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs  0% smaller
  crates/bevy_mod_scripting_core/src/bindings/function/into.rs  0% smaller
  crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs  0% smaller
  crates/bevy_mod_scripting_core/src/bindings/function/magic_functions.rs  0% smaller
  crates/bevy_mod_scripting_core/src/bindings/function/mod.rs  0% smaller
  crates/bevy_mod_scripting_core/src/bindings/type_data.rs  0% smaller
  crates/bevy_mod_scripting_derive/Cargo.toml Unsupported file format
  crates/bevy_mod_scripting_derive/src/derive/script_bindings.rs  0% smaller
  crates/bevy_mod_scripting_derive/src/derive/script_globals.rs  0% smaller
  crates/bevy_mod_scripting_functions/Cargo.toml Unsupported file format
  crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs Unsupported file format
  crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs Unsupported file format
  crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs Unsupported file format
  crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs Unsupported file format
  crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs Unsupported file format
  crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs Unsupported file format
  crates/bevy_mod_scripting_functions/src/lib.rs  0% smaller
  crates/bevy_system_reflection/Cargo.toml Unsupported file format
  crates/lad_backends/mdbook_lad_preprocessor/Cargo.toml Unsupported file format
  crates/ladfile/Cargo.toml Unsupported file format
  crates/ladfile_builder/Cargo.toml Unsupported file format
  crates/ladfile_builder/src/plugin.rs  0% smaller
  crates/languages/bevy_mod_scripting_lua/Cargo.toml Unsupported file format
  crates/languages/bevy_mod_scripting_rhai/Cargo.toml Unsupported file format
  crates/testing_crates/script_integration_test_harness/Cargo.toml Unsupported file format
  crates/testing_crates/test_utils/Cargo.toml Unsupported file format

Copy link
Contributor

github-actions bot commented Aug 23, 2025

🐰 Bencher Report

Branchrefactor/restructure-crates
Testbedlinux-gha
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
nanoseconds (ns)
(Result Δ%)
Upper Boundary
nanoseconds (ns)
(Limit %)
component/access Lua📈 view plot
🚷 view threshold
3,464.80 ns
(-14.12%)Baseline: 4,034.67 ns
4,603.68 ns
(75.26%)
component/access Rhai📈 view plot
🚷 view threshold
5,161.30 ns
(-12.31%)Baseline: 5,885.58 ns
6,669.75 ns
(77.38%)
component/get Lua📈 view plot
🚷 view threshold
2,123.80 ns
(-12.65%)Baseline: 2,431.38 ns
2,776.19 ns
(76.50%)
component/get Rhai📈 view plot
🚷 view threshold
3,907.40 ns
(-10.74%)Baseline: 4,377.43 ns
4,903.07 ns
(79.69%)
conversions/Mut::from📈 view plot
🚷 view threshold
87.31 ns
(-2.58%)Baseline: 89.62 ns
113.31 ns
(77.05%)
conversions/Ref::from📈 view plot
🚷 view threshold
82.30 ns
(-5.45%)Baseline: 87.05 ns
111.73 ns
(73.66%)
conversions/ScriptValue::List📈 view plot
🚷 view threshold
298.15 ns
(+3.75%)Baseline: 287.36 ns
359.48 ns
(82.94%)
conversions/ScriptValue::Map📈 view plot
🚷 view threshold
924.51 ns
(-27.93%)Baseline: 1,282.79 ns
1,634.40 ns
(56.57%)
conversions/ScriptValue::Reference::from_into📈 view plot
🚷 view threshold
26.62 ns
(-1.59%)Baseline: 27.05 ns
50.71 ns
(52.49%)
conversions/Val::from_into📈 view plot
🚷 view threshold
285.23 ns
(-5.50%)Baseline: 301.82 ns
367.13 ns
(77.69%)
function/call 4 args Lua📈 view plot
🚷 view threshold
1,526.50 ns
(-18.48%)Baseline: 1,872.50 ns
2,224.74 ns
(68.61%)
function/call 4 args Rhai📈 view plot
🚷 view threshold
1,348.00 ns
(-13.70%)Baseline: 1,561.93 ns
1,819.84 ns
(74.07%)
function/call Lua📈 view plot
🚷 view threshold
217.20 ns
(-9.55%)Baseline: 240.12 ns
262.88 ns
(82.62%)
function/call Rhai📈 view plot
🚷 view threshold
465.21 ns
(-3.60%)Baseline: 482.60 ns
553.39 ns
(84.07%)
loading/empty Lua📈 view plot
🚷 view threshold
59,309.00 ns
(-8.98%)Baseline: 65,161.30 ns
72,329.16 ns
(82.00%)
loading/empty Rhai📈 view plot
🚷 view threshold
286,770.00 ns
(-22.65%)Baseline: 370,761.00 ns
468,900.77 ns
(61.16%)
math/vec mat ops Lua📈 view plot
🚷 view threshold
6,938.60 ns
(-7.86%)Baseline: 7,530.54 ns
8,554.01 ns
(81.12%)
math/vec mat ops Rhai📈 view plot
🚷 view threshold
6,042.60 ns
(-12.51%)Baseline: 6,906.63 ns
7,802.89 ns
(77.44%)
query/10 entities Lua📈 view plot
🚷 view threshold
17,869.00 ns
(-16.10%)Baseline: 21,299.00 ns
24,838.04 ns
(71.94%)
query/10 entities Rhai📈 view plot
🚷 view threshold
18,275.00 ns
(-14.06%)Baseline: 21,266.00 ns
24,687.26 ns
(74.03%)
query/100 entities Lua📈 view plot
🚷 view threshold
38,948.00 ns
(-10.25%)Baseline: 43,397.10 ns
48,007.34 ns
(81.13%)
query/100 entities Rhai📈 view plot
🚷 view threshold
28,788.00 ns
(-13.11%)Baseline: 33,131.30 ns
37,955.90 ns
(75.85%)
query/1000 entities Lua📈 view plot
🚷 view threshold
249,220.00 ns
(-11.72%)Baseline: 282,305.00 ns
322,208.52 ns
(77.35%)
query/1000 entities Rhai📈 view plot
🚷 view threshold
157,010.00 ns
(-9.94%)Baseline: 174,347.00 ns
197,163.82 ns
(79.63%)
reflection/10 Lua📈 view plot
🚷 view threshold
5,193.00 ns
(-16.47%)Baseline: 6,216.82 ns
7,203.68 ns
(72.09%)
reflection/10 Rhai📈 view plot
🚷 view threshold
14,637.00 ns
(-10.10%)Baseline: 16,281.10 ns
18,158.88 ns
(80.61%)
reflection/100 Lua📈 view plot
🚷 view threshold
43,957.00 ns
(-15.23%)Baseline: 51,852.00 ns
59,628.87 ns
(73.72%)
reflection/100 Rhai📈 view plot
🚷 view threshold
665,250.00 ns
(-12.58%)Baseline: 760,944.00 ns
867,342.27 ns
(76.70%)
resource/access Lua📈 view plot
🚷 view threshold
3,082.30 ns
(-15.85%)Baseline: 3,662.80 ns
4,252.04 ns
(72.49%)
resource/access Rhai📈 view plot
🚷 view threshold
4,743.50 ns
(-11.54%)Baseline: 5,362.01 ns
6,033.49 ns
(78.62%)
resource/get Lua📈 view plot
🚷 view threshold
1,719.00 ns
(-17.42%)Baseline: 2,081.65 ns
2,459.25 ns
(69.90%)
resource/get Rhai📈 view plot
🚷 view threshold
3,504.00 ns
(-9.86%)Baseline: 3,887.18 ns
4,385.20 ns
(79.91%)
🐰 View full continuous benchmarking report in Bencher

@makspll
Copy link
Owner Author

makspll commented Aug 23, 2025

Seems to cut down build time quite a lot, functions can now compile in parallel to bevy components, getting me to 2 minutes build time for an empty consumer crate:
image

@makspll makspll enabled auto-merge (squash) August 23, 2025 20:56
@makspll makspll disabled auto-merge August 23, 2025 20:56
@makspll makspll changed the title refactor: refactor dependencies, point at bevy subcrates directly refactor!: refactor dependencies, point at bevy subcrates directly Aug 23, 2025
@makspll makspll enabled auto-merge (squash) August 23, 2025 20:58
@makspll makspll merged commit 432b91b into main Aug 23, 2025
21 checks passed
@makspll makspll deleted the refactor/restructure-crates branch August 23, 2025 23:41
@github-actions github-actions bot mentioned this pull request Aug 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant