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  28% 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
  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
  crates/bindings/bevy_render_bms_bindings/src/lib.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/src/import_path.rs  7% smaller
  codegen/build.rs  6% smaller
  codegen/src/bin/main.rs  6% 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

🚨 7 Alerts

BenchmarkMeasure
Units
ViewBenchmark Result
(Result Δ%)
Upper Boundary
(Limit %)
component/access LuaLatency
microseconds (µs)
📈 plot
🚷 threshold
🚨 alert (🔔)
5.69 µs
(+24.05%)Baseline: 4.59 µs
5.69 µs
(100.10%)

component/access RhaiLatency
microseconds (µs)
📈 plot
🚷 threshold
🚨 alert (🔔)
9.61 µs
(+48.41%)Baseline: 6.48 µs
9.45 µs
(101.75%)

component/get RhaiLatency
microseconds (µs)
📈 plot
🚷 threshold
🚨 alert (🔔)
8.05 µs
(+61.77%)Baseline: 4.98 µs
7.90 µs
(101.95%)

math/vec mat ops RhaiLatency
microseconds (µs)
📈 plot
🚷 threshold
🚨 alert (🔔)
9.47 µs
(+23.51%)Baseline: 7.66 µs
9.46 µs
(100.09%)

query/10 entities RhaiLatency
microseconds (µs)
📈 plot
🚷 threshold
🚨 alert (🔔)
29.44 µs
(+28.25%)Baseline: 22.95 µs
29.17 µs
(100.94%)

resource/access RhaiLatency
microseconds (µs)
📈 plot
🚷 threshold
🚨 alert (🔔)
9.15 µs
(+54.20%)Baseline: 5.93 µs
8.98 µs
(101.86%)

resource/get RhaiLatency
microseconds (µs)
📈 plot
🚷 threshold
🚨 alert (🔔)
7.54 µs
(+67.91%)Baseline: 4.49 µs
7.38 µs
(102.14%)

Click to view all benchmark results
BenchmarkLatencyBenchmark Result
nanoseconds (ns)
(Result Δ%)
Upper Boundary
nanoseconds (ns)
(Limit %)
component/access Lua📈 view plot
🚷 view threshold
🚨 view alert (🔔)
5,690.90 ns
(+24.05%)Baseline: 4,587.42 ns
5,685.23 ns
(100.10%)

component/access Rhai📈 view plot
🚷 view threshold
🚨 view alert (🔔)
9,613.90 ns
(+48.41%)Baseline: 6,477.82 ns
9,448.69 ns
(101.75%)

component/get Lua📈 view plot
🚷 view threshold
3,109.90 ns
(+5.97%)Baseline: 2,934.76 ns
3,226.75 ns
(96.38%)
component/get Rhai📈 view plot
🚷 view threshold
🚨 view alert (🔔)
8,048.90 ns
(+61.77%)Baseline: 4,975.55 ns
7,895.22 ns
(101.95%)

conversions/Mut::from📈 view plot
🚷 view threshold
87.87 ns
(-15.57%)Baseline: 104.07 ns
120.53 ns
(72.90%)
conversions/Ref::from📈 view plot
🚷 view threshold
84.08 ns
(-16.06%)Baseline: 100.16 ns
116.17 ns
(72.37%)
conversions/ScriptValue::List📈 view plot
🚷 view threshold
375.15 ns
(-4.02%)Baseline: 390.84 ns
448.01 ns
(83.74%)
conversions/ScriptValue::Map📈 view plot
🚷 view threshold
1,040.60 ns
(-12.64%)Baseline: 1,191.14 ns
1,378.42 ns
(75.49%)
conversions/ScriptValue::Reference::from_into📈 view plot
🚷 view threshold
25.15 ns
(-12.58%)Baseline: 28.77 ns
32.92 ns
(76.38%)
conversions/Val::from_into📈 view plot
🚷 view threshold
241.54 ns
(-22.73%)Baseline: 312.61 ns
412.64 ns
(58.53%)
function/call 4 args Lua📈 view plot
🚷 view threshold
1,905.50 ns
(-11.40%)Baseline: 2,150.63 ns
2,438.20 ns
(78.15%)
function/call 4 args Rhai📈 view plot
🚷 view threshold
1,447.60 ns
(-7.45%)Baseline: 1,564.17 ns
1,749.90 ns
(82.72%)
function/call Lua📈 view plot
🚷 view threshold
401.04 ns
(-5.07%)Baseline: 422.44 ns
549.00 ns
(73.05%)
function/call Rhai📈 view plot
🚷 view threshold
493.64 ns
(+1.13%)Baseline: 488.13 ns
554.84 ns
(88.97%)
loading/empty Lua📈 view plot
🚷 view threshold
940,620.00 ns
(-8.29%)Baseline: 1,025,601.00 ns
1,389,517.23 ns
(67.69%)
loading/empty Rhai📈 view plot
🚷 view threshold
1,095,000.00 ns
(-13.97%)Baseline: 1,272,824.00 ns
1,861,119.20 ns
(58.84%)
math/vec mat ops Lua📈 view plot
🚷 view threshold
9,558.30 ns
(+11.39%)Baseline: 8,581.11 ns
9,830.77 ns
(97.23%)
math/vec mat ops Rhai📈 view plot
🚷 view threshold
🚨 view alert (🔔)
9,467.00 ns
(+23.51%)Baseline: 7,664.92 ns
9,458.47 ns
(100.09%)

query/10 entities Lua📈 view plot
🚷 view threshold
20,743.00 ns
(-14.77%)Baseline: 24,336.80 ns
28,113.72 ns
(73.78%)
query/10 entities Rhai📈 view plot
🚷 view threshold
🚨 view alert (🔔)
29,440.00 ns
(+28.25%)Baseline: 22,954.60 ns
29,166.93 ns
(100.94%)

query/100 entities Lua📈 view plot
🚷 view threshold
42,299.00 ns
(-10.23%)Baseline: 47,116.90 ns
52,460.67 ns
(80.63%)
query/100 entities Rhai📈 view plot
🚷 view threshold
41,883.00 ns
(+12.22%)Baseline: 37,322.40 ns
42,780.00 ns
(97.90%)
query/1000 entities Lua📈 view plot
🚷 view threshold
257,290.00 ns
(-16.25%)Baseline: 307,228.00 ns
378,468.01 ns
(67.98%)
query/1000 entities Rhai📈 view plot
🚷 view threshold
173,580.00 ns
(-8.47%)Baseline: 189,650.00 ns
225,057.89 ns
(77.13%)
reflection/10 Lua📈 view plot
🚷 view threshold
5,499.30 ns
(-11.23%)Baseline: 6,195.18 ns
6,900.64 ns
(79.69%)
reflection/10 Rhai📈 view plot
🚷 view threshold
15,360.00 ns
(-4.01%)Baseline: 16,001.10 ns
16,821.72 ns
(91.31%)
reflection/100 Lua📈 view plot
🚷 view threshold
46,583.00 ns
(-11.53%)Baseline: 52,654.50 ns
59,352.42 ns
(78.49%)
reflection/100 Rhai📈 view plot
🚷 view threshold
625,430.00 ns
(-20.80%)Baseline: 789,711.00 ns
967,456.24 ns
(64.65%)
resource/access Lua📈 view plot
🚷 view threshold
3,557.90 ns
(-11.34%)Baseline: 4,013.09 ns
4,514.32 ns
(78.81%)
resource/access Rhai📈 view plot
🚷 view threshold
🚨 view alert (🔔)
9,147.50 ns
(+54.20%)Baseline: 5,932.42 ns
8,980.84 ns
(101.86%)

resource/get Lua📈 view plot
🚷 view threshold
2,575.50 ns
(+1.30%)Baseline: 2,542.50 ns
2,829.50 ns
(91.02%)
resource/get Rhai📈 view plot
🚷 view threshold
🚨 view alert (🔔)
7,542.40 ns
(+67.91%)Baseline: 4,491.93 ns
7,384.70 ns
(102.14%)

🐰 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.

@makspll
Copy link
Owner Author

makspll commented Nov 25, 2025

Those using this PR as a pin should also pin to commit d9501a0 for now, as I'll be shelving my work here.

Currently left to do:

  • Overhauling codegen so that methods like Entity::from_raw_u32 get picked up, currently codegen doesn't support Option<T>. I am at a point where I have the "glue" code, but need to fix how we bootstrap the crate

@makspll
Copy link
Owner Author

makspll commented Dec 17, 2025

I've split out my holiday stash into a follow up: #503, this PR should work as normal, but some of the bindings might not be optimal yet (like from_raw no longer exists without an optional wrapper, so codegen needs to improve to keep up with bevy) But the codegen improvements I am planning will drastically increase coverage to match existing trait implementations

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