feat!: Bevy 0.17
Tracking issues so far:
- [x]
WithWorldAccessis not feasible anymore due to the inability to read component accesses into a system param at initialization - [x] 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)
- [x] stack overflows with dynamic systems
Changed Files
Bencher Report
| Branch | feat/bevy-0.17 |
| Testbed | linux-gha |
🚨 6 Alerts
| Benchmark | Measure Units | View | Benchmark Result (Result Δ%) | Upper Boundary (Limit %) |
|---|---|---|---|---|
| component/access Rhai | Latency microseconds (µs) | 📈 plot 🚷 threshold 🚨 alert (🔔) | 9.48 µs(+46.71%)Baseline: 6.46 µs | 9.33 µs (101.69%) |
| component/get Rhai | Latency microseconds (µs) | 📈 plot 🚷 threshold 🚨 alert (🔔) | 8.08 µs(+62.22%)Baseline: 4.98 µs | 7.92 µs (101.96%) |
| math/vec mat ops Rhai | Latency microseconds (µs) | 📈 plot 🚷 threshold 🚨 alert (🔔) | 9.48 µs(+23.61%)Baseline: 7.67 µs | 9.47 µs (100.10%) |
| query/10 entities Rhai | Latency microseconds (µs) | 📈 plot 🚷 threshold 🚨 alert (🔔) | 30.70 µs(+33.00%)Baseline: 23.08 µs | 30.34 µs (101.18%) |
| resource/access Rhai | Latency microseconds (µs) | 📈 plot 🚷 threshold 🚨 alert (🔔) | 8.87 µs(+50.18%)Baseline: 5.90 µs | 8.72 µs (101.72%) |
| resource/get Rhai | Latency 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
| Benchmark | Latency | Benchmark 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 | 📈 view plot 🚷 view threshold | 92.37 ns(-11.63%)Baseline: 104.53 ns | 117.53 ns (78.59%) |
| conversions/Ref | 📈 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 | 📈 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%) |
Aaaand we're back
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.
Those using this PR as a pin should also pin to commit 42d87a0 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