Skip to content

Conversation

@makspll
Copy link
Owner

@makspll makspll commented Nov 6, 2025

Tracking issues so far:

  • WithWorldAccess is not feasible anymore due to the inability to read component accesses into a system param at initialization
  • Handles don't have a weak wariant anymore, we wither go all AssetId or store strong handles, atm heading towards strong handles everywhere. This proves troublesome when receiveing modification events which don't have a handle, and you cannot get a strong handle with a path from an asset id (the path comes from the asset server load call, and not having it means script names don't show up in logs)
  • stack overflows with dynamic systems

@semanticdiff-com
Copy link

semanticdiff-com bot commented Nov 6, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/bindings/bevy_input_bms_bindings/src/lib.rs  99% smaller
  crates/bindings/bevy_gizmos_bms_bindings/src/lib.rs  98% smaller
  crates/bindings/bevy_animation_bms_bindings/src/lib.rs  97% smaller
  crates/bindings/bevy_input_focus_bms_bindings/src/lib.rs  95% smaller
  codegen/src/passes/codegen.rs  88% smaller
  crates/bindings/bevy_a11y_bms_bindings/src/lib.rs  85% smaller
  crates/bevy_mod_scripting_core/src/script/script_context.rs  84% smaller
  crates/bindings/bevy_text_bms_bindings/src/lib.rs  83% smaller
  crates/bindings/bevy_math_bms_bindings/src/lib.rs  81% smaller
  crates/bindings/bevy_picking_bms_bindings/src/lib.rs  80% smaller
  crates/testing_crates/test_utils/src/test_plugin.rs  78% smaller
  crates/bindings/bevy_gltf_bms_bindings/src/lib.rs  77% smaller
  crates/bindings/bevy_color_bms_bindings/src/lib.rs  75% smaller
  crates/bevy_mod_scripting_core/src/pipeline/machines.rs  68% smaller
  crates/bevy_mod_scripting_bindings/src/world.rs  67% smaller
  crates/bevy_mod_scripting_core/src/script/mod.rs  63% smaller
  crates/bevy_mod_scripting_bindings/src/reference.rs  57% smaller
  codegen/src/passes/find_trait_impls.rs  55% smaller
  crates/bindings/bevy_mesh_bms_bindings/src/lib.rs  54% smaller
  crates/testing_crates/script_integration_test_harness/src/test_functions.rs  51% smaller
  codegen/src/passes/populate_template_data.rs  49% smaller
  crates/bevy_mod_scripting_bindings/src/function/script_function.rs  46% smaller
  crates/bindings/bevy_scene_bms_bindings/src/lib.rs  45% smaller
  crates/bindings/bevy_time_bms_bindings/src/lib.rs  44% smaller
  crates/bevy_mod_scripting_core/src/pipeline/start.rs  43% smaller
  crates/bevy_mod_scripting_core/src/event.rs  43% smaller
  crates/bindings/bevy_sprite_bms_bindings/src/lib.rs  43% smaller
  crates/bindings/bevy_pbr_bms_bindings/src/lib.rs  42% smaller
  crates/bevy_system_reflection/src/lib.rs  31% smaller
  codegen/crates/crate_feature_graph/src/graph.rs  31% smaller
  crates/bindings/bevy_image_bms_bindings/src/lib.rs  29% smaller
  xtask/src/lib.rs  28% smaller
  crates/languages/bevy_mod_scripting_lua/src/lib.rs  25% smaller
  crates/bevy_mod_scripting_core/src/handler.rs  25% smaller
  codegen/src/passes/find_reflect_types.rs  25% smaller
  crates/bevy_mod_scripting_bindings/src/schedule.rs  24% smaller
  examples/game_of_life.rs  21% smaller
  codegen/src/import_path.rs  20% smaller
  crates/bevy_mod_scripting_core/src/commands.rs  19% smaller
  crates/testing_crates/script_integration_test_harness/src/scenario.rs  18% smaller
  codegen/src/passes/find_methods_and_fields.rs  17% smaller
  crates/testing_crates/script_integration_test_harness/src/parse.rs  16% smaller
  crates/bevy_mod_scripting_core/src/pipeline/mod.rs  12% smaller
  crates/testing_crates/script_integration_test_harness/src/lib.rs  11% smaller
  codegen/src/callback.rs  11% smaller
  codegen/src/args.rs  10% smaller
  crates/bindings/bevy_ecs_bms_bindings/src/lib.rs  10% smaller
  codegen/src/context.rs  9% smaller
  crates/bevy_mod_scripting_core/src/script_system.rs  7% smaller
  codegen/build.rs  6% smaller
  codegen/src/bin/main.rs  6% smaller
  crates/bindings/bevy_render_bms_bindings/src/lib.rs  5% smaller
  xtask/src/main.rs  4% smaller
  crates/bindings/bevy_core_pipeline_bms_bindings/src/lib.rs  3% smaller
  crates/testing_crates/test_utils/src/test_data.rs  1% smaller
  crates/bevy_mod_scripting_core/src/script/context_key.rs  1% smaller
  crates/bindings/bevy_asset_bms_bindings/src/lib.rs  1% smaller
  .github/workflows/synchronize_bindings.yml  0% smaller
  .github/workflows/synchronize_bindings_check_diff.yml  0% smaller
  Cargo.toml Unsupported file format
  assets/scripts/game_of_life.lua  0% smaller
  assets/scripts/game_of_life.rhai Unsupported file format
  assets/tests/add_system/added_systems_run_in_parallel.lua  0% smaller
  assets/tests/add_system/added_systems_run_in_parallel.rhai Unsupported file format
  codegen/Cargo.bootstrap.toml Unsupported file format
  codegen/crates/crate_feature_graph/src/feature.rs  0% smaller
  codegen/rust-toolchain.toml Unsupported file format
  codegen/src/candidate.rs  0% smaller
  codegen/src/driver/mod.rs  0% smaller
  codegen/src/lib.rs  0% smaller
  codegen/src/meta.rs  0% smaller
  codegen/src/passes/cache_traits.rs  0% smaller
  codegen/src/passes/crawl_paths.rs  0% smaller
  codegen/src/passes/mod.rs  0% smaller
  codegen/src/passes/write_meta.rs  0% smaller
  codegen/src/plugin.rs  0% smaller
  codegen/templates/footer.tera Unsupported file format
  crates/bevy_mod_scripting_bindings/Cargo.toml Unsupported file format
  crates/bevy_mod_scripting_bindings/src/function/from.rs  0% smaller
  crates/bevy_mod_scripting_bindings/src/script_component.rs  0% smaller
  crates/bevy_mod_scripting_core/Cargo.toml Unsupported file format
  crates/bevy_mod_scripting_core/src/extractors.rs  0% smaller
  crates/bevy_mod_scripting_core/src/lib.rs  0% smaller
  crates/bevy_mod_scripting_core/src/pipeline/hooks.rs  0% smaller
  crates/bevy_mod_scripting_functions/Cargo.toml Unsupported file format
  crates/bevy_mod_scripting_functions/src/core.rs  0% smaller
  crates/bevy_mod_scripting_script/src/lib.rs  0% smaller
  crates/bindings/bevy_a11y_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_animation_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_asset_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_camera_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_camera_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_camera_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_color_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_core_pipeline_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_ecs_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_gizmos_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_gltf_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_image_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_input_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_input_focus_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_light_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_light_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_light_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_math_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_mesh_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_pbr_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_picking_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_post_process_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_post_process_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_post_process_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_reflect_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_reflect_bms_bindings/src/lib.rs Unsupported file format
  crates/bindings/bevy_render_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_scene_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_sprite_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_sprite_render_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_sprite_render_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_sprite_render_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_text_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_time_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_transform_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_transform_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_ui_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_ui_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_ui_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_ui_render_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_ui_render_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_ui_render_bms_bindings/src/lib.rs  0% smaller
  crates/testing_crates/test_utils/Cargo.toml Unsupported file format
  examples/run_script.rs  0% smaller
  makefile Unsupported file format
  xtask/src/args.rs  0% smaller
  xtask/src/codegen.rs  0% smaller
  xtask/src/command.rs  0% smaller
  xtask/src/features.rs  0% smaller

@github-actions
Copy link
Contributor

github-actions bot commented Nov 11, 2025

🐰 Bencher Report

Branchfeat/bevy-0.17
Testbedlinux-gha

🚨 6 Alerts

BenchmarkMeasure
Units
ViewBenchmark Result
(Result Δ%)
Upper Boundary
(Limit %)
component/access RhaiLatency
microseconds (µs)
📈 plot
🚷 threshold
🚨 alert (🔔)
9.48 µs
(+46.71%)Baseline: 6.46 µs
9.33 µs
(101.69%)

component/get RhaiLatency
microseconds (µs)
📈 plot
🚷 threshold
🚨 alert (🔔)
8.08 µs
(+62.22%)Baseline: 4.98 µs
7.92 µs
(101.96%)

math/vec mat ops RhaiLatency
microseconds (µs)
📈 plot
🚷 threshold
🚨 alert (🔔)
9.48 µs
(+23.61%)Baseline: 7.67 µs
9.47 µs
(100.10%)

query/10 entities RhaiLatency
microseconds (µs)
📈 plot
🚷 threshold
🚨 alert (🔔)
30.70 µs
(+33.00%)Baseline: 23.08 µs
30.34 µs
(101.18%)

resource/access RhaiLatency
microseconds (µs)
📈 plot
🚷 threshold
🚨 alert (🔔)
8.87 µs
(+50.18%)Baseline: 5.90 µs
8.72 µs
(101.72%)

resource/get RhaiLatency
microseconds (µs)
📈 plot
🚷 threshold
🚨 alert (🔔)
7.62 µs
(+69.40%)Baseline: 4.50 µs
7.46 µs
(102.18%)

Click to view all benchmark results
BenchmarkLatencyBenchmark Result
nanoseconds (ns)
(Result Δ%)
Upper Boundary
nanoseconds (ns)
(Limit %)
component/access Lua📈 view plot
🚷 view threshold
5,433.10 ns
(+19.10%)Baseline: 4,561.64 ns
5,456.01 ns
(99.58%)
component/access Rhai📈 view plot
🚷 view threshold
🚨 view alert (🔔)
9,484.50 ns
(+46.71%)Baseline: 6,464.88 ns
9,327.04 ns
(101.69%)

component/get Lua📈 view plot
🚷 view threshold
3,272.70 ns
(+10.90%)Baseline: 2,951.04 ns
3,337.88 ns
(98.05%)
component/get Rhai📈 view plot
🚷 view threshold
🚨 view alert (🔔)
8,075.70 ns
(+62.22%)Baseline: 4,978.23 ns
7,920.36 ns
(101.96%)

conversions/Mut::from📈 view plot
🚷 view threshold
92.37 ns
(-11.63%)Baseline: 104.53 ns
117.53 ns
(78.59%)
conversions/Ref::from📈 view plot
🚷 view threshold
92.19 ns
(-8.70%)Baseline: 100.97 ns
110.76 ns
(83.23%)
conversions/ScriptValue::List📈 view plot
🚷 view threshold
397.18 ns
(+1.05%)Baseline: 393.05 ns
448.42 ns
(88.57%)
conversions/ScriptValue::Map📈 view plot
🚷 view threshold
1,234.60 ns
(+1.99%)Baseline: 1,210.54 ns
1,335.20 ns
(92.47%)
conversions/ScriptValue::Reference::from_into📈 view plot
🚷 view threshold
27.35 ns
(-5.65%)Baseline: 28.99 ns
31.82 ns
(85.94%)
conversions/Val::from_into📈 view plot
🚷 view threshold
321.87 ns
(+0.38%)Baseline: 320.64 ns
395.08 ns
(81.47%)
function/call 4 args Lua📈 view plot
🚷 view threshold
1,898.00 ns
(-11.72%)Baseline: 2,149.88 ns
2,442.56 ns
(77.71%)
function/call 4 args Rhai📈 view plot
🚷 view threshold
1,479.40 ns
(-5.61%)Baseline: 1,567.35 ns
1,738.57 ns
(85.09%)
function/call Lua📈 view plot
🚷 view threshold
373.82 ns
(-10.94%)Baseline: 419.72 ns
551.91 ns
(67.73%)
function/call Rhai📈 view plot
🚷 view threshold
459.85 ns
(-5.14%)Baseline: 484.75 ns
555.27 ns
(82.82%)
loading/empty Lua📈 view plot
🚷 view threshold
1,429,700.00 ns
(+33.06%)Baseline: 1,074,509.00 ns
1,561,988.86 ns
(91.53%)
loading/empty Rhai📈 view plot
🚷 view threshold
2,034,400.00 ns
(+48.85%)Baseline: 1,366,764.00 ns
2,210,788.76 ns
(92.02%)
math/vec mat ops Lua📈 view plot
🚷 view threshold
10,074.00 ns
(+16.70%)Baseline: 8,632.68 ns
10,230.96 ns
(98.47%)
math/vec mat ops Rhai📈 view plot
🚷 view threshold
🚨 view alert (🔔)
9,475.50 ns
(+23.61%)Baseline: 7,665.77 ns
9,466.12 ns
(100.10%)

query/10 entities Lua📈 view plot
🚷 view threshold
22,106.00 ns
(-9.67%)Baseline: 24,473.10 ns
27,265.50 ns
(81.08%)
query/10 entities Rhai📈 view plot
🚷 view threshold
🚨 view alert (🔔)
30,698.00 ns
(+33.00%)Baseline: 23,080.40 ns
30,340.99 ns
(101.18%)

query/100 entities Lua📈 view plot
🚷 view threshold
44,317.00 ns
(-6.34%)Baseline: 47,318.70 ns
51,317.98 ns
(86.36%)
query/100 entities Rhai📈 view plot
🚷 view threshold
44,073.00 ns
(+17.40%)Baseline: 37,541.40 ns
44,550.18 ns
(98.93%)
query/1000 entities Lua📈 view plot
🚷 view threshold
281,410.00 ns
(-9.12%)Baseline: 309,640.00 ns
369,425.07 ns
(76.18%)
query/1000 entities Rhai📈 view plot
🚷 view threshold
190,310.00 ns
(-0.53%)Baseline: 191,323.00 ns
223,357.49 ns
(85.20%)
reflection/10 Lua📈 view plot
🚷 view threshold
5,330.10 ns
(-13.73%)Baseline: 6,178.26 ns
7,018.28 ns
(75.95%)
reflection/10 Rhai📈 view plot
🚷 view threshold
14,538.00 ns
(-8.67%)Baseline: 15,918.90 ns
17,331.88 ns
(83.88%)
reflection/100 Lua📈 view plot
🚷 view threshold
45,507.00 ns
(-13.40%)Baseline: 52,546.90 ns
60,036.41 ns
(75.80%)
reflection/100 Rhai📈 view plot
🚷 view threshold
618,890.00 ns
(-21.57%)Baseline: 789,057.00 ns
971,634.56 ns
(63.70%)
resource/access Lua📈 view plot
🚷 view threshold
3,979.80 ns
(-1.86%)Baseline: 4,055.28 ns
4,325.48 ns
(92.01%)
resource/access Rhai📈 view plot
🚷 view threshold
🚨 view alert (🔔)
8,866.90 ns
(+50.18%)Baseline: 5,904.36 ns
8,717.36 ns
(101.72%)

resource/get Lua📈 view plot
🚷 view threshold
2,737.70 ns
(+6.99%)Baseline: 2,558.72 ns
2,889.99 ns
(94.73%)
resource/get Rhai📈 view plot
🚷 view threshold
🚨 view alert (🔔)
7,623.10 ns
(+69.40%)Baseline: 4,500.00 ns
7,460.53 ns
(102.18%)

🐰 View full continuous benchmarking report in Bencher

@makspll
Copy link
Owner Author

makspll commented Nov 12, 2025

Aaaand we're back
image

@shanecelis
Copy link
Contributor

Quite a feat!

Handles don't have a weak variant anymore, we wither go all AssetId or store strong handles, atm heading towards strong handles everywhere. This proves troublesome when receiving modification events which don't have a handle, and you cannot get a strong handle with a path from an asset id (the path comes from the asset server load call, and not having it means script names don't show up in logs)

That'll work. It keeps the script asset resident even though in many cases it could be unloaded since what we often care about is the context, but that's probably not a lot of memory being eaten.

Idle Consideration: ContextHandle?

A ways back when I was in this code, it felt almost like there was a context handle or something that wanted to get out and be expressed. Something where given a Handle<ScriptAsset> you'd load it and receive a ContextHandle or ScriptLoadedHandle. It doesn't quite fit in Bevy's asset framework, I don't think. But it feels like this something you'd want to capture yourself with HashMap<AssetId, (AssetPath<'static>, ContextId)>.

Anyway, just my idle consideration. Don't let me sidetrack you from finishing Bevy 0.17 support.

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.

3 participants