#bevy_new_2d
1 messages Β· Page 3 of 1
Monitor is not an entity IIRC, so relationship wouldn't work, no?
Monitor is an entity
oh, nice!
Then relationship is the way to go, yeah π
All right time to try and understand how relationships work in 0.16 since I've not really touched them yet.
@finite depot https://crates.io/crates/bevy_link_window_to_monitor
Just tested this, and wow, this is quite nice for productivity. Thanks again!
Thanks for publishing this π
Looks really solid, good job!
My pleasure!
I could probably make the documentation a bit better, but it's like...super simple.
You either just...use the Plugin and it automagically manages it or you don't and use the function to get the Monitor directly.
Life hack: you can include your readme in your docs π
That's nice in docs.rs and allows you to add usage examples to your readme that will be validated by cargo test --doc
Also this
I'll try all three of these in foxtrot real quick and report back on the result
I tested a bunch of settings a while back: https://github.com/rparrett/bevy_wasm_bench
Going to update this to add panic and test with Bevy 0.16. (results there are from Bevy 0.14)
Oh right, I remember this! Thanks for bringing it up again π
Update: went from
- 176 Mib uncompressed, 102 MiB compressed to
- 136 MiB uncompressed, 98 MiB uncompressed
Could you ping us in https://github.com/TheBevyFlock/bevy_new_2d/issues/402 when you're done?
Best wait until https://github.com/rparrett/bevy_wasm_bench is updated to 0.16
Sure. Will start the thing running before I head to work this morning.
thanks a bunch!
How's the vibe here regarding CI speedups that involve things like nightly, mold, cranelift, etc?
not for releases, just for the regular CI
cargo-nextest is a thing too, idk if it offers any benefits over cargo-test if you're only running a couple of tests though
i'm definitely in favor of this for my jam template at least
I'm adding it right now to avian to test
On it for Foxtrot as well π
let me know how it goes and i'll take a look
btw are you considering running CI using the same nightly toolchain as bevy_lint so the cache can be shared?
because that's a thought that crossed my mind at one point
my template is down to 2.5GB total cache size (between 4 caches) for now π
I did not π
Update: cranelift does not like wasm, and nextest considers "no tests to run" an error π
(needs cargo nextest run --no-tests pass or warn)
btw, should we be passing --no-fail-fast to cargo test?
good idea, yes it should!
(Currently trying to figure out how to use mold without clang so that our wasm builds can use mold)

Here's what I can offer so far: https://github.com/janhohenheim/foxtrot/pull/379
@tacit verge am I missing anything?
getting these times on Foxtrot now with no cache
Which is pretty sweet if not for the web build
maybe I should remove it
I overestimated how useful it would be
Then again, we did have compile errors in the 2D template on wasm that went undiscovered for a while
And for jams, it makes sense to make that the only build in the CI
or just do continuous deployment like @tacit verge
Yeah, convinced myself to keep it π
I'm having a sliiiight suspicion that nextest is not being cached, though π
https://github.com/Jondolf/avian/pull/731 is causing recompilations
nvm, that was not it. Maybe cache-all-crates: true?
In any case, here's the equivalent for Bevy New 2D: https://github.com/TheBevyFlock/bevy_new_2d/pull/405
we may be able to cargo check for web instead of fully building it
good point
sec
let me know when i should review the pr
i'm gonna update our labels to match bevy's labels better and be more useful
we have so many open workflows issues π
now
I wasn't able to put the ugly RUSTFLAGS into env for some reason π€·ββοΈ
In general, I'd be happy if we could merge it like this and let you do a cleanup as a followup, since I believe you know your way around workflows wayyyyy better than me haha
yeah i wouldn't mind that
i'll probably workshop it into my own template and come back with another pr
i'll approve it after CI finishes
thanks π
hold up
ope
does the config.toml override the RUSTFLAGS or merge them
i'm not sure
Easy way to test: I'll just add garbage to the env var
oh nvm it does merge
I had an issue where I put --cfg getrandom_backend="wasm_js" in there and non-wasm builds failed
so that var is still read
Let me quickly test the other way around: https://github.com/TheBevyFlock/bevy_new_2d/pull/407
meh
There, should be good now π
@tacit verge I moved all rustflags to the config.toml
Because turns out the env vars have precedence over that file
ahh ok
LINTER_TOOLCHAIN no longer needed?
i don't see where it's moved to
We use the GH Action
That env var was IIRC there because we used to install it manually
not bad without cache
Could be better by using cranelift more aggressively, but I'd wait with that until we can confirm that it no longer crashes the test runner
I last checked that about 9 months ago, so there's a decent chance it got better π
hmm you know what? avian has a lot of tests, let me check there real quick
Update: every test with #[should_panic] gets a panic while panicking, failing the test 
Ready for merge, in that case
BTW, nextest is indeed wayyyy faster on yarnspinner
that one has many tests, so I notice the difference
this doesn't seem to be the case: https://github.com/TheBevyFlock/bevy_new_2d/pull/365/files#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133dd
i'm not sure what that env variable is for, though. the action does indeed set the correct nightly toolchain when installing bevy_lint, but maybe it does something when bevy_lint runs?
@tranquil breach do you know what the LINTER_TOOLCHAIN env variable is for? the CI seems to work without it and i can't find any references in the bevy CLI repo
is this doing the same work as the 24m fresh CI from earlier but in 10m?
notably cargo test has to compile your crate to run tests, so technically there are two builds in CI
so how did nextest perform on foxtrot and bevy_new_2d? no noticeable improvement? i think as long as it isn't a regression when there are barely any tests, it's still good to include in case a user ends up adding many of their own tests
done
ok looking at the new CI runs in bevy_new_2d, i can see the results:
- format, docs, bevy lints, and clippy are unaffected
- build for web -> check web goes from ~16m to ~4m
- tests goes from ~12m to ~10m
i found that you can install cargo-nextest via taiki-e/install-action, which explicitly supports cargo-nextest but also falls back to cargo-binstall if it can't find the tool you want:
- use: taiki-e/install-action@nextest
i'm not sure what the tradeoffs are for this vs. installing cargo-binstall and then manually running cargo binstall cargo-nextest
it might just be a convenience so you don't need an earlier step to install cargo-binstall first, but i'll look into it a bit
regarding passing --secure to cargo binstall, i couldn't find it in cargo binstall -h. turns out it's enabled by default and the flag is deprecated
No, this is bevy_new_2d
Donβt remember what our original time was there
Ah, thx for checking. I got that from nextest's website
I guess that looks nicer when we have inly one thing to install? Dunno
nextest takes a few more seconds (< 10) when there are no tests, which I think is alright
So about 35% better? Nice
Especially considering that the private repos are about twice as slow IIRC
that's true, it's possible the other jobs will show a difference in private repos
btw, the list of tools supported by taiki-e/install-action doubles as a nice resource for discovering useful cargo tools :p
i don't think mold does anything when we don't do any linking (aka produce a binary), so we should only install it for Tests
well maybe cargo check involves linking for procedural macros and build.rs, actually
same thing for cranelift if there's no codegen involved
also i'm wondering if we really need to install Bevy's Linux dependencies (apt-get ...) for simple commands like cargo doc
mm nope something is needed at least:
error: failed to run custom build command for `wayland-sys v0.31.6`
[...]
The system library `wayland-client` required by crate `wayland-sys` was not found.
if you do a fresh build of a workflow that has a few jobs sharing the same cache, they'll all try to save their artifacts as the new cache when they finish
the first job to finish will succeed in saving its artifacts, the later jobs will log a warning
we could put save-if: false on all but one of the jobs to guarantee which job saves its artifacts and avoid the warnings
through trial and error, i've determined that only libxkbcommon-dev can be omitted, but it can be omitted from every job
in my personal template with extra dependencies, here's a fresh build:
i set all the jobs to use the same nightly toolchain so they can all share a cache. Clippy lints finished first so it was the job that saved its cache
and this is the following run using the 550MB cache from Clippy lints:
bevy lints spent 56s compiling bevy_lint from source, so it would've been ~50s
so that confirms we can share a cache between Docs, Clippy lints, and Bevy lints if we set them to the same nightly toolchain
i'll try letting Tests save the cache instead and see how that affects things
Ah yes youβre right
Good idea π
How can your template take longer than foxtrot? 
Ah wait it's about the same
You can remove it! That was added back when there wasnβt a dedicated bevy_lint action and the tool chain needed to be hardcoded
(Reminder for me: create a bug report)
update: cargo test uses the test profile while the other 3 jobs use the dev profile, so their build artifacts seem to be inherently incompatible
Oh, TIL
But makes sense
Trying something new now: What if we built the tests with dynamic linking and cached the dynamic libraries?
Also, we should be able to remove opt-level = 3 from the test config
Just need to override what the Cargo.toml says
hrmm --all-features already implies dynamic linking
But I don't see anything in the swatinem docs that suggests it would cache the dynamic library dir
weird
Just to be sure, I added it to my cached dirs
can't hurt
Let's see what this does to foxtrot
(talking about rustc --print target-libdir)
note that I added the .rustup path myself
Hmm, that added a minute to my Foxtrot cold build:
dunno if that was a fluke
same changes improve speed by one minute on bevy_new_2d
Cache hit on Foxtrot is a little under 2 minutes now
Where compiling + running the tests is just 22 seconds
Just realized that my work code is on a private repo, so I'll try the same CI setup there to see the speed
Update: 28m 58s without cache for a project that uses Bevy + Burn as main dependencies
This will give new meaning to last minute jam fixes π
@tacit verge installing nextest with --force can take quite a while on Windows for some reason (~40 sec), I noticed on avian. Do you know which path we need to add so that the cached nextest is found?
this change here is not enough :/
In any case, this is ready for merging imo
Just thought of something else: If we disallow all linting from uploading their cache, they could in theory just reuse the cache of the tests job, too π
though that would increase the time for downloading the cache, not sure if worth
pinged Bjorn about this 
I was also thinking that. Especially because bevy build web also executes wasm-bindgen, which shouldn't reveal any further errors, right?
yeah I didn't even consider that
It's now doing just check on main FYI π
Unfortunately there's no bevy check, so I had to do cargo check --config 'profile.web.inherits="dev"' --features dev --no-default-features --profile web --target wasm32-unknown-unknown
which is... a bit more verbose
But what I actually want to use is bevy test web
Yeah fair, I guess for all the config stuff it's useful
Exactly. It's lovely being able to set features etc. for web directly in the Cargo.toml π
I guess bevy check is kinda bevy lint, in a way... but also doesn't have web integration
huh, you're right
bevy lint may benefit from accepting web
Let me open an issue
try taiki-e/install-action@nextest instead of installing cargo-binstall followed by binstalling it
idk if it would be any different but may be worth a try
i think this is what i tried earlier and didn't work because test vs dev profile being incompatible
maybe there's a way to run tests in the dev profile, or make them compatible, idk π
although i assume that may make the tests themselves run slower
oh right I forgot
Good idea
It does solve it... by virtue of reinstalling it
idk, maybe it will get cached on a different path?
Ready for re-review
is there a reason we want to cache cargo-nextest in our github cache? we're basically installing it from cache already
Hmm fair enough
It just seems that whatever binstall was doing to restore it takes long on Windows
But idk if the GH cache would be faster
Not sure since I added few optimizations at a time to avian, as one non-cached build takes 35 mins
@tacit verge not sure about option precedence, so I set both to be sure: https://github.com/TheBevyFlock/bevy_new_2d/pull/408/commits/dd7b8217b6b5c16d043b59dc02e3768af6aeb5cf
iirc opt-level = 1 should be about as fast as opt-level = 0
also optimization matters to some extent for tests because the tests actually run
so idk what the optimal balance is, but we can probably expect there not to be that many tests so i can see opt-level = 1 being reasonable
btw let me know if I should implement anything on our to do list for the next jam
I'm mainly eagerly awaiting the pause menu right now π
Also, I'm very much in favor of https://github.com/TheBevyFlock/bevy_new_2d/issues/138 now
Workaround for: actions/cache#1175. Suggested here: https://stackoverflow.com/questions/69365200/github-actions-how-to-cache-dependencies-between-workflow-runs-of-different-bra.
But it's also fine to leave it until jam 7
just enabling -Zshare-generics=y -Zthreads=0 brought my fresh Tests job from 17m30s to 14m20s
sample size of 1 :p
without mold or cranelift or opt-level changes
cached Tests job went from 1m51s to 1m31s
cache size also went from 900MB to 840MB
also about 25-30s faster for fresh Docs, Clippy lints, and Bevy lints jobs
for cached, maybe a little bit faster? but within noise
i'm gonna try mold next
mold was actually within noise or actually slower (probably noise) for every job on a fresh ci run
that's -Z arguments compared to -Z arguments + mold
cache size is unchanged
i'll still try a cached run with mold
pretty neat π
interesting π
Just FYI, if you ever decided to add a Windows CI runner for some weird reason, that needs to have -Zshare-generics=n when using dynamic linking 
yeah no difference
surprising, but we probably shouldn't enable mold in that case
will test -Z vs -Z + cranelift next
cranelift made no difference or was slower in a fresh run, and cache size is unchanged too
I'd expect it to shine in partial rebuilds where only the top-level crate needs rebuilding
do we want to use nightly toolchain and -Z args for releases too?
is there any reason not to?
other than -Zshare-generics on windows release
actually that seems to only be an issue for windows + dynamic linking, but release builds disable dynamic linking so it should be fine
Many years ago, it used to sometimes create broken builds
But I have not experienced that since like, pff, 6 years?
But I know some people are iffy about it
I personally would enable it for releases, yes
yep
But I'd also personally reuse caches for releases too, and I know some people are very against anything but a completely clean build on releases π€·ββοΈ
well caches are only really good for frequently run jobs
or i guess if you're sure your dependencies are never going to change :p
I mean, I have a lockfile for that
And if that didn't change, why not reuse the cache from the last release build?
Not that that's possible right now
smh github
somehow -Zshare-generics=y -Zthreads=0 made no difference to my web release compile time
welp
Did you try LLD for that yet?
is it possible bevy CLI doesn't pick up RUSTFLAGS?
is that not the default linker?
nope
Pretty sure it does, since otherwise it would run into that getrandom thing
ic
so do i need linker = "lld" in .cargo/config_ci.toml for that?
exactly, and add it to the dependencies for sudo apt-get install
If it's not on the runner by default
i'll leave testing that for the next bevy jam maybe π
enough workflow tinkering for me i think
it's in a pretty good place at this point i think. i'll just make a PR to bevy_new_2d to align with the results of tinkering in my personal template
thanks!
I think I'd still leave mold and cranelift on
Since we have such a simple use-case, a more complex game might very well see improvements
hmm my template is already 3000 lines of rust with a decent number of additional 3rd-party crates
fair enough
i'm open to adding them back in the future with evidence that they help ofc
you sure you want to remove the config_ci.toml? It's pretty nice for tinkering
mmm
i think in favor of simplicity yes, since we don't strictly need it after this pr, but i do see the value
works for me
Why -Cincremental=no?
i can remove that, i haven't tested it individually so i'm not sure how much it contributes, but it should reduce the amount of work the compiler has to do
probably marginally at best
Looks like it's already off by default on our CI: https://github.com/TheBevyFlock/bevy_new_2d/actions/runs/15009718253/job/42176127539#step:10:6
context starts here i think: #1271949921708146770 message
I think we would need it again to check LLD on Wasm builds, right?
Not sure you can set that otherwise
basically my logic was: Swatinem/rust-cache doesn't save incremental build artifacts anyways (source), so no point in generating them
but actual impact not measured
yeah i think so
no need to test that within bevy_new_2d itself though, if we have evidence that it helps in a different repo that's good enough
this link isn't expanding to a specific step for me
Should be this:
ah ok, env variable
aha!
i'm curious why it does that, but in that case you're right, we don't need the flag
Still thinking about this
Judging by https://perf.rust-lang.org, from-scratch builds with incremental compilation enabled adds about 15β20% overhead compared to disabled. The initial build needs to write out more intermedia...
I'm just not looking forward to moving all rustflags over to that file again and adding the mv step to all jobs if we decide to use it again
But I also see that right now, there's little benefit
oh interesting, Swatinem/rust-cache also sets CARGO_INCREMENTAL=0 π
hehe
yeah i get that. we can block the pr if you want to test lld first?
I wonder what a user would prefer? I can see someone finding the extra file annoying, but I can also see them being glad that they can tinker with settings without having to understand the GH workflow
can do
Queued some builds
cargo build webwith LLDcargo build webwithout LLDcargo testwith mold + craneliftcargo testwithout mold but with craneliftcargo testwithout mold and without cranelift
(don't expect to get anything other than what you did, but can't hurt to check)
i could've done something wrong, the lack of results was surprising to me, so i'm glad to get more data
Looking at only the build times themselves:
- Web
- With LLD: 10m 39s and 10m 20s (did two runs accidentally)
- Without LLD: 13m 28s
- Native
- With mold + cranelift: 13m 51s
- Without mold, without cranelift: 14m 38s
Looks like LLD is surprisingly good for Wasm π
yep
is there a reason you chose build web to test lld, and test to test mold / cranelift?
No reason really
But you're right, should have done build for native
also is this with -Z flags enabled for all cases?
yep
lld is supposed to be slower than mold in theory right
that's what I've heard, yeah
I could also try using LLD for native and see what happens
Right now I'm running mold without cranelift
No, all Foxtrot
ah ok
Wish I could enable mold somehow for wasm to compare 
Googling has only revealed threads with people saying it must be possible somehow
I've seen one person change symlinks to let mold pretend it's lld
maybe wasm is particularly bottlenecked by linking somehow..
I don't really see how, but then again, I have very little knowledge about any of the wasm build stuff works, so π€·ββοΈ
Mold w/o cranelift: 15m 7s 
good question
this can be dragged????
it's like a minigame while you wait for CI to pass
somehow LLD now broke for all builds, even web
the heck
@tacit verge explain to me
How can this commit here: https://github.com/janhohenheim/foxtrot/commit/22ef3d994c64434274390ff3b2dedf954c8381d3
Break the web build????
I am shook
Yes, I checked
or does the web build magically pick up target.x86_64-unknown-linux-gnu by mistake?
because the host OS is linux
That would be weeeeird
it might be some bevy cli related weirdness, assuming you're using bevy cli commands
it's cargo build
Testing locally, if I enter bogus in my wasm target config as a linker, bevy build web correctly picks up on it
On another note, I managed to get mold working with wasm locally
and these are fresh builds i assume, full cache miss
Oh, that might actually be it
symlink /usr/bin/ld to /usr/bin/mold
^note that the symlink is from ld, not lld
oh wait nvm that crashes too
so much for "drop-in replacement"
yeah i see in the action that it was a partial cache hit so it restored from the fallback cache
hm
actually that makes sense
that would explain it, yeah
you only edited .cargo/config_ci.toml, but Swatinem/rust-cache doesn't include that file in the hash to see if you've changed something important
I'm getting supremely sleepy over here, so this is all for today I can muster
I guess we found out that mold is not that fast after all in our use-case and that lld is good at wasm?
Not sure how rigorous that testing was
I'm also fine with merging your PR now if you really don't like the config_ci.toml, it's fine
that would have been the last test, but my eyes will fall shut if I wait for it π
yeah for sure
i'll leave the PR open for now because the lld + wasm result was significant
i can work on pause / settings menu stuff anyways :)
I approved it in the meantime (TIL you can approve drafts)
I'll leave it up to you to include the config.toml or not
ok sounds good
I think -Clinker=lld should also work when set in the RUSTFLAGS env var
Or -Clinker=rust-lld, whatever that means
hold up what
So Wasm should already use LLD by default?????
maybe that's outdated? the post is from 2020
@tranquil breach @normal shale any idea what might explain these results?
and this, is mold bad actually or does the setup-mold action not work? i'm not sure how to investigate this
(Note: I might have hecked up and had partial cache hits in these tests)
For dev builds on Linux, you could also try the wild linker if you haven't already :)
There was also a RustWeek talk about it but unfortunately I missed it :(
I heard that it's quite fast though
Honestly, no idea :P
Thanks for all this thorough testing though, that will be of great use to everyone!
TIL about wild
@tacit verge that readme contains some benchmarks that make me think we tested noise
Their differences with LD are in the range of 1 second or below
Which makes a huge difference when going partial rebuilds (e.g. 5 vs 6 seconds on my machine) but are probably totally gobbled up by our clean build times
So the more representative use-case could be to test a cache hit
Same with cranelift
Otherwise, we have all that compilation noise in the background that is completely unaffected by the linker or cranelift
Since I'm a bit tired of benching these, I'm personally gravitating towards trusting the people who already benched non-Bevy use cases and using cranelift + wild + that extra config file.
After some deliberation, I think having a separate file is more user friendly, as that allows you to completely ignore the workflow and stay in Rust land when tuning these knobs
But if you feel strongly about this increasing our complexity for only theoretical gains, I'm fine with merging your PR as-is too
Btw, wild supports binstall, so adding should be trivial π
Since Foxtrot does not use #[should_panic], I tried activating cranelift for all deps. The clean built time for the tests job went from 16 minutes to 6 minutes π
well that's pretty significant
why were we disabling cranelift for deps again?
hmm the issue is a 1s improvement isn't worth it in CI, where you have the overhead of installing the tool every time instead of on your local machine where you only install it once
plus added complexity meaning more chances for something to break, and more surface area to debug when something goes wrong
even if this overhead is like 1s on average, that just cancels out the win
Fair
Itβs panic = abort, so tests depending on #[should_fail] will break
We could of course just tell people to use llvm if they add such tests
@finite depot @tacit verge I briefly mentioned your CI compile time experiments to some compiler/AWS people and they were interested in the data
Also apparently better caching is being worked on
Thx for sharing the data, I hope its useful to them
Well I didn't share it yet, just mentioned it. But I have their contact information so I can forward it
Ah alright
It's mostly n = 2 though π
Or if you're interested,I can connect you and maybe they can also share insights back on what we can improve further
not sure how significant any of that is
You could shoot them an invite link to this channel if they want
Fair, but its better than nothing :D
I think they are on the zulip, not sure if they use Discord. But I can ask
You'll have better luck reaching out to them on Zulip π
I'll do that, and @tacit verge and @finite depot if you're on Zulip I can connect you to them :)
BTW linking this in here because it's relevant: https://discord.com/channels/691052431525675048/1372507436296175686
that issue is now fixed :) (#1278871953721262090 message)
I recently saw that.
Thx for fixing it so quickly!
Good call on skipping the review process for that one π
Why not Fat?
this plot is misleading because it includes codegen_units = Default datapoints
if you remove them, the difference between Fat and Off becomes almost negligible, and it costs 2x build time
basically lto only makes a huge difference in the absence of codegen-units = 1
which makes sense: if you already optimized everything as a single unit at compile time, you don't need to optimize everything as a single unit again at link time
Oooh I see, fair point
How is codegen units 1 faster build than default?
Because the binary size is smaller so wasm bindgen takes longer?
somehow the compile time and wasmopt time are both lower
although the former could be noise
otoh, codegen-units only optimizes within your crate while lto should be able to optimize between your crate and your dependencies
more codegen-units probably only helps with build time if your crate is big enough to benefit from parallel compilation within the crate
i think the results are also partially skewed by the fact that the benchmarked project isn't representative of a real game :p
it's more like a stress test, so it's performance sensitive but the code surface is small
(it's this crate: https://github.com/rparrett/bevy_wasm_bench/tree/main/bench)
Maybe I should repeat that test while automatically running through the foxtrot level
that would be interesting, maybe limited to a much smaller set of option combinations so it doesn't take forever
would probably also want multiple frame time measurements per build to reduce noise
ultimately i think there is no perfect option combination, as long as we have reasonable evidence-based defaults plus explanations i think we're good (for bevy_new_2d specifically)
i'm not able to compile bevy_new_2d on my machine right now: #general message
i ran into that issue while trying to compile my personal template, figured i'd try to compile bevy_new_2d to isolate the problem, but that failed with the same message
if someone can try compiling bevy_new_2d with nightly rust 1.89, especially on linux, and let me know if it succeeds or fails, that would help me narrow this down
~$ rustc --version
rustc 1.89.0-nightly (d97326eab 2025-05-15)
~$ cargo --version
cargo 1.89.0-nightly (056f5f4f3 2025-05-09)
disabling cranelift, -Zshare-generics=y, -Zthreads=0, mold, and sccache didn't help
I'll give it a try, just cargo check?
i think it's a link-time issue so try cargo build
another user has hit this btw: #general message
I also had this weird problem on nightly: https://github.com/rust-lang/rust/issues/141085
I wonder if it's related
It seems to work for me.
rustc 1.89.0-nightly (d97326eab 2025-05-15)
binary: rustc
commit-hash: d97326eabfc3b2c33abcb08d6bc117aefa697cb7
commit-date: 2025-05-15
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.4
interesting
Ah nevermind, I get the error on cargo run, just not cargo build
ahh ok
switching to nightly-2025-04-03 (bevy_lint's pinned version) fixed the issue for me
so that confirms that it's a nightly rust bug
Now I wonder if that happens on the bug reproduction repo I created for the wasm-bindgen bug, if it's the same features that need to be enabled
Yea I think it might be the same bug, there get "linking with clang failed".
@tacit verge can you check https://github.com/TimJentzsch/bug_wasm-bindgen_env if you get the same error there?
i'll take a look
I was able to narrow it down to the tonemapping_luts and webgl2 features
#1373244882151280660 message narrows down the nightly version to >2025-05-14
actually i'll get back to this tomorrow, it's late here and i want to write some actual code now that i can compile
Fair enough!
i made the settings menu from pause vs from title screen reuse the same code in my personal template
the trick is to make the title screen's ui actually come from the "main menu", aka a new Menu::Main state
so when you transition from Menu::Main to Menu::Settings and back, it fully replaces the UI but you stay in the same Screen (same for Menu::Pause and Menu::Settings)
can do the same in bevy_new_2d, but without state stacks "go back" is awkward when there are 2 possible previous states
so i think for bevy_new_2d i'll split that into MainSettings and PauseSettings, calling into the same settings() -> impl Bundle, and call it good
although that also means if you want to go deeper with AudioSettings, DisplaySettings, etc., you'll need both a Main and a Pause version of each state π
I think thatβs fine for the moment. Most serious games will have a dedicated submenu for those, but I think this is fine for the scope we are operating on
Hey @tacit verge @finite depot , sorry to bother you again, I'm trying to summarize the CI performance findings you had to share with the compiler team.
(I'll add a disclaimer that it's a very low sample size and probably not very representative).
What I got so far:
-Zshare-generics=y -Zthreads=0=> ~20% faster, 7% less size- Incremental builds are bad for CI (quickly fill up cache)
- LLD is quite fast for Wasm
cranelifta lot better (~160%) without#[should_panic], but makes no difference otherwise- mold performs worse or similar to LLD
Is that accurate? Anything else I should add?
not quite, sec
Cranelift makes the compile time go from 16 min to 6 min when used for the entire dependency tree. However, we cannot use that for tests in general, as cranelift is panic=abort, so should_panic tests fail. So we only used it for the top-level crate, where it does not make a speed difference on CI
Maybe there is a cool set of compilation settings that allows us to keep should_panic tests by compiling some dependency with LLVM and the rest with cranelift?
Mold had no measurable effect on our total compilation times
Compared to LLD, right?
Compared to the default native linker, which is not LLD on Linux yet
I think LD?
Using LLD on Wasm made a huge difference, but that seems very sus to me, as I believe Wasm already uses rust-lld by default, so I'm very skeptical of our results there
This is the reasoning for disabling incremental, but we didnβt compare the performance, since two of our GitHub actions already disable incremental compilations automatically (without us knowing, at first)
The ecosystem in place really really does not want consumers to enable incremental compilation on CI, I expect nearly no one using github workflows has it enabled
The two Z flags are huuuge improvements. Just note that I was not able to profit from share generics on avian, as we run the tests on multiple OS, including Windows. For extra build speed, we use Bevy's dynamic linking, but that breaks share generics on Windows
I think that are all my comments π
what jan said covers it all. making the jobs use compatible toolchain / options so they can share a cache made a big difference for cache size, but that's probably obvious
Fixes #391
Built releases to test at: https://github.com/DanBellman/foxtrott/actions/runs/15091963069
not sure if this is an error I made in Foxtrot or relevant to the 2D template
@tacit verge friendship with tweak_fn has ended; now subsecond is my new best friend
BTW I just found out why "setting LLD on Wasm" increased our performance on CI.
We mayyyyy currently accidentally ignore the -Z flags for Wasm builds π
Haven't verified how it behaves with CI env vars, but .cargo/ci_config.toml stuff would definitely be ignored in bevy run web.
The reason it worked faster in my tests is because I had the getrandom stuff in the config.toml instead of the Cargo.toml.
We could just remove that, but then it results in a very weird footgun to debug for users that happen to pull in getrandom as a transitive dependency
i'll take a look at subsecond π
hmm i'm not following how the config_ci.toml being ignored causes setting LLD to make web builds faster?
something about the getrandom cfg overwriting all the other rustflags so we lose out on the -Z arguments?
Yep. In my faster run, I happened to move the rustflags from the Bevy CLI-specific config to the generic config.toml, which meant that the other flags were correctly passed in that run
I'm still figuring out the right combination of settings to make it run as fast as possible and running into weird things like https://github.com/DioxusLabs/dioxus/issues/4149
But right now, I get a fully hotpatched function 0.3s after hitting CTRL-S
that sounds pretty promising
i saw in the example they wrote out the same system twice and had one call HotFn::new(system).call(..args) or w/e
would be nice if that was just a proc-macro attribute, it looks like it easily could be
especially if the proc macro was smart and compiled itself out of existence in release builds
Yep, already added an issue: https://github.com/DioxusLabs/dioxus/issues/4143
i just found that π
And right now writing a little crate for just that π
With a bit of luck, this should work later today:
use bevy::prelude::*;
use bevy_simple_subsecond_system::prelude::*;
fn main() {
dioxus_devtools::connect_subsecond();
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(SimpleSubsecondPlugin::default())
.add_systems(Startup, setup)
.add_systems(Update, configure_ui)
.run();
}
#[derive(Component)]
struct Ui;
fn setup(mut commands: Commands) {
commands.spawn(Ui);
commands.spawn(Camera2d);
}
#[hot]
fn configure_ui(ui: Single<Entity, With<Ui>>, mut commands: Commands) {
commands.entity(*ui).insert(Text::new("Hello, world!"));
}
SimpleSubsecondPlugin could call dioxus_devtools::connect_subsecond() internally?
exactly
#[derive(Debug, Default)]
#[non_exhaustive]
pub struct SimpleSubsecondPlugin;
impl Plugin for SimpleSubsecondPlugin {
fn build(&self, app: &mut App) {
dioxus_devtools::connect_subsecond();
}
}
ah, you left that line in fn main in the snippet you sent π
Ah my bad
yeah that would be great, i'd definitely try it out during the jam
and before ofc to get it working
Meh, looks like that one really has to be called by main
interesting
I'll see if I can generate another bug report
oh wait it fails regardless now
π
Debugging this is definitely not the most enlightening experience
But when it works, it's great
There we go!
amazing
oooh, that's neat
Is there a way to hook into reloading states to rerun enter systems in some way?
like you'd want to trigger a same-state transition by editing some code?
bevy_state doesn't support same-state transitions, you have to leave the state and re-enter it if you want to trigger your OnExit and OnEnter systems for the current state
not due to any technical limitations, i have it implemented in pyri_state
but anyways i'm not sure what code you could edit to trigger a state transition on hot reload, that seems more in the territory of an editor / inspector
maybe you could have a special hot-reloaded exclusive system somewhere that runs once whenever you change it
so you could write world.enter_state(current_state) (pseudocode + assuming same-state transitions are supported), save the file, and it would run that code once
I know, I've been using a special reset state to get around that.
Well something like rerunning the setup systems like create UI and whatnot. That would require teardown code anyway, so probably something like the system showed by @finite depot makes much more sense for iteration (and then pulling that into actual systems).
maybe the hotpatching setup could support custom "on hotpatch" hooks so you could add one to e.g. re-enter the current state
like it could send an event you could observe
I'd love to have that, but I haven't found any API in subsecond that tells you it just hotpatched something
Oh nvm
@tacit verge why did we again reparate a lib.rs and a main.rs? Just for organizational purposes?
Asking because subsecond doesn't like that
does subsecond work per-crate or something?
Oooh right, for a tests dir, correct?
yah
It currently only patches things in the bin
its also rec'd in the Rust book, so I imagine there's a lot of people doing this: https://doc.rust-lang.org/stable/book/ch12-03-improving-error-handling-and-modularity.html#separation-of-concerns-for-binary-projects
TIL
It's planned to be available for deps, but not implemented yet
good to know pre-jam at least
we can do src/bin/run.rs instead of src/main.rs fwiw, that's what i do in my template because i also have a bin/debug.rs
oh, by bin I meant "top level crate thingy"
ah ok
I believe once you are referencing code behind a lib.rs, subsecond is gone
btw just want to share that i'm experiencing the most cursed bug i've ever seen while trying to set up the settings menu in my personal template
dbg!((audio_config.music_volume - 0.1).max(0.0)); // This is equal to 0.3
let x = (audio_config.music_volume - 0.1).max(0.0);
audio_config.music_volume = x;
dbg!(audio_config.music_volume); // This is equal to 35.0
I know why!!
There's an atrociously weird line of code in the Volume code that calls abs on negative volumes
that's why in Foxtrot, I first convert it to f32, do math on that, then convert it back to Volume
hmm but audio_config.music_volume is an f32, and in the above math it doesn't go negative, it goes from 0.4 to 0.3
Oh I thought it was a Bevy Volume
nvm then
only explanation i can think of is i'm invoking UB somewhere
which i might just be considering i have an unsafe impl of Bundle elsewhere
adding this code right before the snippet i posted "fixed" the bug:
let x: f32 = 0.4;
dbg!(x, (x - 0.1).max(0.0));
let y: f32 = (x - 0.1).max(0.0);
dbg!(y);
maybe cranelift is breaking something
well it's not cranelift
Stack corruption?
possibly, but how is this happening in rust π
i removed the unsafe code and it didn't fix it either
AUDIO WARNING!
this is after a full clean compile with my entire .cargo/config.toml commented out and unsafe code removed
my best guess for now is unsafe code in a dependency (probably bevy) that is not properly vetted for safety
I've had it happen before through deps
Little one can do except find out which dep API is causing weirdness by bisecting your history
btw, this looks supremely neat π
cargo test --doc also doesn't work without a lib.rs
....
i found the "35.0"
i changed the width to Vw(32.0), and the volume bugged to 32.0 instead of 35.0
i suppose that's consistent with stack corruption?
what's crazy is how consistent this is, i tried compiling with stable channel and a different nightly version and saw the same behavior
actually no i figured something else out
this is the full snippet:
#[tweak_fn]
fn master_volume() -> impl Bundle {
fn master_volume_down(_: Trigger<Pointer<Click>>, mut audio_config: ConfigMut<AudioConfig>) {
let audio_config = r!(audio_config.get_mut());
audio_config.master_volume = (audio_config.master_volume - 0.1).max(0.0);
}
fn master_volume_up(_: Trigger<Pointer<Click>>, mut audio_config: ConfigMut<AudioConfig>) {
let audio_config = r!(audio_config.get_mut());
audio_config.master_volume = (audio_config.master_volume + 0.1).min(1.0);
}
(
Name::new("MasterVolume"),
Node {
width: Vw(35.0),
justify_items: JustifyItems::Stretch,
..Node::ROW
},
children![
widget::small_button("<", master_volume_down),
widget::stretch(children![(widget::label("50%"), IsMasterVolumeLabel)]),
widget::small_button(">", master_volume_up),
],
)
}
the bug started happening when i moved the observer functions into the containing function
removing #[tweak_fn] from the containing function fixes it
so somehow the macro is broken (maybe it doesn't expect inner functions?) in a really weird way
luckily i can replace my usage of #[tweak_fn] with the upcoming hotpatching which is surely not also cursed
thanks for
support :)
hmmm setting up a window resolution selector is tricky even with bevy_link_window_to_monitor
i can get a window's current monitor now, but i can't get a window's current video mode...
i'm feeling like it's very awkward that window.mode is basically set up as an API for setting the window mode instead of reading it
it's more like window.next_mode_intent right now
i mean, i can get the window's resolution, but not its video mode
at least i can see if the window is in Windowed, BorderlessFullscreen, or Fullscreen, but that's the extent of what you get
also it's possible "video mode" is meaningless if the window is in Windowed mode? i don't have the windowing knowledge here
i'm gonna shelf this for now
i'm going to try hotpatching next. @finite depot is v0.1.2 of this crate what i should try? or should i wait for something in the works? https://github.com/TheBevyFlock/bevy_simple_subsecond_system/
(technically this is unrelated to this thread but w/e)
Give me a few mins
You can use it now, I'm just adding a feature for automatically rerunning your systems on hot patches
so that Startup systems can just rerun
Done π
@finite depot the #[hot] macro doesn't like argument-position impl Trait?
it might just be rust-analyzer being weird one sec
this was a great resource: https://www.gameuidatabase.com/index.php?set=1&sort=1&vid=1&plat=1&tag=20&scrn=29
Oh; I may have to fix that
Hi! It may be another day or two before the CLI gets released, we got held up with some branding issues over in #1278871953721262090
Weβre working on it, though, and weβre trying our best to give you all some time to upgrade before the jam :)
no rush :)
we might consider merging lib.rs and main.rs to remove one hurdle for users who want to experiment with bevy_new_2d + hotpatching for this jam
Yeah I think I'm in favor
Maybe even a little section in the README pointing to it
i have one of those in pyri_new_jam already
And explaining that you need to disable dynamic linking
yeah that would be nice
in the "run your game" section of the readme
Just add the disclaimer about disabling dynamic linking as well
Since that is a bit burried inside the "Limitations" section
Repeated
will whip up pr
thanks!
can i do "make sure to read the [known limitations] section!" with a link instead?
I would mention it explicitly still.
The other limitations are fairly specific, while that one is the one that is guaranteed to not work out of the box unless you disable it in the template
also, should i keep the #[cfg_attr] in the recommended annotation
but in this case feature = "dev" i guess
I think so, yeah
even though that means it'll be enabled for web dev builds which doesn't work
We don't have native_dev on the template?
Huh
Wanna add it?
nice
for enabling file watcher atm
is --profile dev really necessary for dx serve? does it not default to that profile?
for bevy_new_2d at least i think --features dev_native isn't necessary because we have that as a default feature
where do you get that from?
hmmm
ah i'm just being silly i think
i probably got it from bevy run --verbose and never questioned it
btw i'm liking the affordance from adding an ellipsis here
i might go through and add that to all our details sections if you agree
oh yeah it's neat π
I like it. Good idea!
I'll check in a few mins, max an hour π
yep 
there seems to be noticeable delay when playing UI sound effects on web
i noticed it in my own template and then found the same issue in bevy_new_2d
if you quickly flick your cursor over and past a button and pay attention, it feels like ~200ms delay
idk if i had this issue when i was using bevy_kira_audio, i migrated to bevy_audio recently
i think my previous jam submission using bevy_kira_audio also has some delay, but it feels like less (which could be due to the sound effect being different)
ok wait i like this better
it looks good when expanded
the underline makes it feel like a clickable link while also making it stand out as a mini header for its expanded contents
hmm i can't seem to get github to render the underline though. <u> tag didn't work, <summary style="text-decoration: underline"> didn't work
nvm i got it, needed the <ins> tag
Can confirm. I really need to check out bevy_seedling at some point
TIL
@tacit verge I see you didn't feel like including that hack π
Reviewed 
we could bring bevy_new_minimal up to a "checkpoint" / snapshot of bevy_new_2d's metadata and workflows
instead of keeping them constantly in sync
especially since i imagine not everyone will use -t 2d with bevy new
that can at least wait for the 2 draft prs touching metadata
agreed
Having at least something, even if not fully up-to-date, is probably better than nothing
this was a pain to get working
interaction disabling the buttons at the edges
the hard part is re-enabling the left button when you click the right button for example
Could you use a relationship between the right and left buttons?
hmm maybe
this is what i'm doing currently
i'm traversing the selector's entity hierarchy to get the relevant entities
because i didn't want to make 3 different marker components for each volume selector
the correct solution is probably 3 relationships from the main selector entity to the three parts, left button, label, and right button
that's still so awful though
Oof I see
something something reactivity (i'm not a ui dev but i think that's what this needs)
True Bevy devs say "Letβs wait until BSN"
i moved a couple issues to Bevy Jam 7 milestone that i don't see myself being motivated to work on before jam 6
the remaining 3 issues should be completable imo
cargo-binstall for bevy_cli has a draft pr, i'm planning on adding a pause menu (tomorrow i guess), and explaining the profile/features setup in the design doc is just some writing
Thank you so much for doing those tasks π
I'm suuuper excited for the pause menu implementation π
yeah it's really bad on Wasm
it's binstall time
i love how bevy_state makes it hard to say something like "upon exiting any screen, close the current menu" :p
yes i am working on the pause menu for bevy_new_2d rn
i'll just have to make this explicit per screen
What, you don't like adding a new ScreenScoped<T> for every single screen?
also there may be menu-related 1-frame delays
because i can't do Screen.before(Menu) (pseudocode) in bevy_state
BTW were you now able to use #[hot] everywhere?
I've so far only added it to functions that I wanted to actually touch, but I'm also considering putting it literally everywhere
yes but not the function that returned a system (it compiled and the outer function gets hot patched, but the internal system does not because an instance of it was already returned to the app.add_systems call before the hot patch)
Oh right I forgot you mentioned that
I could have an extension on ScheduleLabel or however that thingy is called that could do .hot_patched()
app.add_systems(
Update,
wait_for(23).hot_patched()
)
I believe the upstreamed version in Francois PR woudln't even need anything like that and just work out of the box
yeah if i can just enable a feature on bevy in Cargo.toml it's golden
with an optional macro to tack on some hotpatch-related configuration, that does nothing if the feature is disabled
Exactly what I was thinking, agreed
I like how the duckie is looking at the menu options
Hehehhe
first one adding pause menu, second one adding gameplay pausing
i'm gonna leave the translucent pause overlay to a separate pr too :)
i got Esc working for menu navigation (it's all hard-coded π)
ah i should probably add a header saying "paused" lol forgot (EDIT: added)
I'll check it out tomorrow π
One thing I'm worried about is that right now, quite a few people may be experimenting with the CLI and the template due to the jam
Which would lead people to use the template in a half-done state if we merge it now
Should we maybe merge all pausing PRs into a separate branch first?
So that we can review parts A, B, C individually while merging them into pause-feature and then merge that branch into main once its done without a new review
(beyond a sanity check of course)
hmm idk how to do that, but sure
just create a branch on bevy_new_2d and point the current PR to that branch instead of main?
done, the pr targets bevy_new_2d:pause now
@finite depot bevy_seedling seems to still be on bevy 0.15?
ah too bad
@finite depot would appreciate review on https://github.com/TheBevyFlock/bevy_new_2d/pull/386 whenever you have time, i've tested that it works in pyri_new_jam :)
approved π
awesome thanks
there's a 0.16 branch. I actually just asked them if there was going to be a release for the jam
oh will bevy_seedling help with the audio delay? hmm
should on native, won't yet on Wasm
oh π
Author says they want to change audio handling to use JS in the background eventually though
i'll probably still use it in pyri new jam for the native improvement though
for the 2 people that download native builds
maybe no point recommending it then? or what's the current value add
at least not before the jam
cool new spatial API, I believe
but I haven't tried it out yet
so my word is worth veeery little in this regard
i also wonder how it compares to bevy_kira_audio, which seems to have some spatial audio support as well
idk
@unkempt drift :)
i experimented with bevy_seedling in my template
i'm not seeing any noticeable audio delay in my native build (idk if i had any with bevy_audio though)
audio buses are convenient for changing the volume of an entire category of sounds (already-playing and future)
it takes a little bit of setup to use them, but it's about the same as the setup for the marker components we're already doing anyways
and then bevy_seedling also provides pitch randomization (behind a feature flag) and other audio effects, which i still need to experiment with
and you can apply the effects to individual sounds, or an entire audio bus
API is pretty close to bevy_audio
i think it's reasonable to suggest it for the audio effects / spatial audio
I'd say pitch randomization would be worth the price of admission alone. That being said, I don't see a feature for that π
should be rand
oh wait hm
ah there it is, it's in the bevy-0.16 branch π
I just looked at the readme of the 0.16 branch at the feature list. My bad π
what's the fix for this again? i have --cfg getrandom_backend="wasm_js" in my env.RUSTFLAGS...
The "wasm_js" backend requires the `wasm_js` feature for `getrandom`
do i need to enable that feature too? i added bevy_seedling as a dep which has an optional dependency on rand = 0.9, but my cargo tree -i rand doesn't reveal a duplicate version
so i'm confused why i've started hitting this now
i do see two getrandom deps in my tree
i fixed it by adding this to my Cargo.toml:
[dependencies]
getrandom = { version = "0.3", default-features = false, features = ["wasm_js"], optional = true }
[features]
web = ["dep:getrandom"]
i still don't know what triggered this
aaaa so bevy CLI also compiles wasm-bindgen-cli from source if you don't already have it, during the bevy build web command
and having --cfg getrandom_backend="wasm_js" in your RUSTFLAGS when that second compilation happens also triggers the error, but you can't fix it in the same way because you can't change wasm-bindgen-cli's Cargo.toml
we should be binstalling the thing anyways so i think i'll add the missing pre-binstall and call it good π€ͺ
i think i should bring this workaround to bevy_new_2d before the jam so users don't hit this when they add xyz dependency
also i think i'll look into the RUSTFLAGS overwriting issue. pretty sure when we tested mold etc. in CI we weren't actually testing anything because env.RUSTFLAGS was overwriting config_ci.toml
i don't feel like spending a ton of time on workflows though.. so i'm only going to compare nothing enabled to everything enabled (via env.RUSTFLAGS to make sure it's not being overwritten)
actually this doesn't normally happen. it happened in relation to this warning:
warning: failed to run wasm-bindgen, trying to find automatic fix...
idk what caused this warning though :)
ah ok i figured it out. it happens on a clean build. on a cached build, we restore the wasm-bindgen binary as well so no need to reinstall
well bevy_seedling seems to fix the audio latency issue on web
but now it's trying to fastforward the beginning of my BGM in a very jarring way
getting super choppy audio now oof
while i'm just in the settings menu of my template
okay i think sadly now is not the time to recommend bevy_seedling, unless there's a fix i'm not aware of
ngl it's crazy to me that web release + wasm-bindgen + wasm-opt is 4 minutes faster than.. running tests with no optimizations or features
both uncached
what am i missing?
hmm github has somewhat recently started offering linux arm64 runners that are supposedly much faster, but only for public repositories π
also ive realized we're compiling dependencies with opt-level = 3 for dev / test builds in CI because of our Cargo.toml...
i added a custom [profile.ci] optimized specifically for build time and it shaved 2m off of clean Docs, Clippy lints, and Bevy lints jobs
the Tests job failed with profile ci not found (known profiles: default, default-miri), maybe a next-test issue? π
okay.. cargo-nextest has its own concept of "profile" and doesn't support setting a different cargo profile, cool cool
gotta say goodbye then
oh here's another neat thing, now that the Tests job is using the same profile ci as the other jobs.. it can use the same cache! (i just have to re-enable --all-features)
Meh
So I could get the tests down to 4 min on Foxtrot π
(Cold)
yup, and maybe lower if some other stuff pans out
not yet
i'm gonna try cranelift and mold etc. again once i'm done with this
maybe wild
to see if the RUSTFLAGS overwriting was the issue
Makes sense that we didnβt see any speedups with mold tho
Should be in the order of single seconds faster
yeah makes sense
Oh right, I changed that in the version with a config.toml IIRC
(Maybe just for foxtrot idk)
Consider me interested π
Cranelift π
Huh I thought it worked the same as bevy_audio in web
cold run with --profile dev and --profile test
Did you tell Corvus?
cold run with --profile ci
hehe
Did you read the related drama? π
saved to one cache but cache size is 990 MB now for some reason
skimmed only
i haven't yet
ok wait no this makes sense. opt-level = 0 wouldn't even include optimizations to reduce file size
honestly.. --profile ci could set opt-level = "s"
This one dev is like
No, I have to take a stance against cargos shitty rustflag handling, this will stay shitty until cargo fixes this on their end, itβs time send a signal!!
Our resident rat sent 2 PRs already to fix it
With about similar results
ok somehow cache sharing did not end up as planned
Tests job was happy and took 40s, all the other jobs took 2m
even though they're all using --profile ci and --all-features and the same toolchain
Oh hey you inverted the problem!
haha
yeah, it looks like they're working on improving the status quo upstream recently :)
design work
opt-level = "z" experiment
and somehow the cache size isn't even significantly reduced
it may be that it mostly reduces the size of the final binary, which we aren't caching anyways
but then what is it spending so much time doing while compiling dependencies smh π©
make it make sense
second time i've seen this happen
another theory: do we really need to install build dependencies on a full cache hit?
the build dependencies are required to build certain cargo deps, but they're already built and restored from cache
Tests job still needs them, the other ones don't!
this saves ~5-10s on cache hit for all jobs except Tests
This is what I had with nextest!
Hm, what do you mean by this?
I wouldnβt expect any significant performance regression, unless itβs maybe at opt-level = 0.
the first ~10s of the music played through quickly before it settled in to playing normally, and it sounded weird
i'm using opt-level = 3. i don't know if the issues i encountered were related to fps
Hm, it sounds like the audio time is trying to βcatch up,β and likely is related to FPS due to the current main-thread backend. (Although Iβd maybe still expect that to happen with rodio.)
Iβll see if I can repro this with the two later.
it may be startup fps issues, but that's surprising to me because i don't spawn the SamplePlayer for the music until entering the title screen and everything should already be loaded etc. at that point so fps should be fine
if it helps, i experienced the issue in my template on this commit: https://github.com/benfrankel/pyri_new_jam/commit/740003ddb76c3b772c92f08a2bd166a3bad1a80d
yeah this keeps happening.. i think i'll add --force but that's so odd
it might be some type of interaction between cargo-binstall and Swatinem/rust-cache. it sees some evidence that bevy_cli is installed so it skips installing it, but maybe only the evidence was cached but not the actual binary
because it should be cached, other binaries are restored from cached
ok i just hit this issue for wasm-bindgen-cli! binstall skips it because it's "already installed", but then bevy_cli sees that it's not installed so it has to install it from source, which hits the wasm_js error
i wonder if we should force a cold run unless the cache is a full match to avoid cache size ballooning over time
pro: users don't have to know to / worry about clearing cache every once in a while to reduce cache size and ci time (downloading a large cache takes longer)
con: the overall ci usage will probably still be higher due to the occasional cold runs overshadowing the 1-3s gains from downloading a smaller cache in cache hits, especially if user changes Cargo.toml often
another option: 10% chance to ignore a partial cache hit for stochastic cache resetting 
it could also be considered a correctness / memory leak type of issue
my hypothesis seems to be correct! i found this issue: https://github.com/Swatinem/rust-cache/issues/237
which is actually a dupe of this issue: https://github.com/Swatinem/rust-cache/issues/204
and there's an issue for this already with the same reasoning: https://github.com/Swatinem/rust-cache/issues/177
On docs.rs we've recently run into disk space issues in CI. Debugging it I noticed that we had a very large cache (3GB compressed), looking at the lists of files there were many duplicate versi...
installing build dependencies with apt-get took 1m40s on the arm64 runner π
up from 10s on ubuntu-latest
same story on both ubuntu-24.04-arm and ubuntu-22.04-arm so i guess that's a dead end
hmmmmmmm cold run of Tests job with mold enabled through env.RUSTFLAGS took 3m16 on the actual compilation step
cold run without mold took 4m18
sample size of 1 ofc but i mean..
far cry from the old 17m lmao how far we've come
hm ok there's another variable involved, i switched from --all-features to no features between those two so it's not a fair comparison. but i've never seen Tests run that fast
ok the other jobs didn't benefit from mold at all on a cold run. going to try Tests again with no cache, no mold, and no features
3m14 seconds, so that seems to confirm the differentiating factor was the features, not mold
in that case i'm not seeing any benefits to mold in CI again, so no point even looking at wild imo due to amdahl's law. cranelift next
2m58s with cranelift enabled
not sure if that's just noise, and not sure if i have it set up properly
2m55s on another run with cranelift + mold
that's sample size of 2 now without cranelift vs with, so the 15-25s speedup seems real
ok notably installing bevy_lint went from 30s to 17s with cranelift and mold enabled lol
only issue is due to the way the action is set up that currently means installing the rust toolchain twice so the savings are lost. will have to see if i can work around that
3m06 on another run
and a 3m02s with cranelift but no mold
another idea: saving the cache takes 10-15s, so it's probably not a good idea to have the job that's already the bottleneck (Bevy lints) do that
ok final results, cold run:
cached run:
Bevy lints is the bottleneck for cached runs now by a wide margin. not only does it take 30-35s to compile bevy_lint, it also takes like 15s longer just to run the lints
here's the issue on bevy cli repo: https://github.com/TheBevyFlock/bevy_cli/issues/461
i'll bring the improvements over to bevy_new_2d soon
For only the top crate or all deps?
Yeah makes sense. The speedup is in single seconds, the install time is in single seconds.
How far weβve come from 15+ min indeed, haha
Can we just cache /usr/bin? 
should be all deps..
it's enabled with -Zcodegen-backend=cranelift
the other stuff wasn't faster either on the arm64 runner unfortunately
idk what the deal is there but i gave up after that
edit by @Noratrieb: MCVE: https://github.com/bash/rust-dylib-crash I tried this code: Clone https://github.com/TheBevyFlock/bevy_quickstart and run cargo run --release on Windows I expected to see ...
@tacit verge looks like the rust folks repaired something we ran into in the past
Do you remember what the issue was? I think it was doing a lto = thin + dynamic linking + release mode on Windows?
@tacit verge I finally did the review on the pause menu, sorry for taking a while π
For the follow-ups, I'll try to get them done ASAP so that Chris can do the video
Let me know if I can help somehow other than reviewing
ah i forgot to push the commit that removes -Zshare-generics=y before merging, since it's supposedly enabled by default for lower opt-levels
oh well nbd
going to bed now, gameplay pausing tomorrow
good night π
In a talk on RustWeek it was said that opt level z is pretty useless right now and maybe should even be removed π€·ββοΈ
@finite depot my pr broke the release workflow due to #1278871953721262090 message
i could fix this by adding a web = ["dep:getrandom"] feature and enabling that instead of "dep:getrandom" directly
unless you have a better idea
nvm, fix found! just remove dep:
hm just thought about potential like 2s saving from cargo binstall crate1 crate2 crate3 ...
so the downloads can happen in parallel
Oh, didnβt know it was parallel when used like that
in release workflow we binstall bevy_cli, wasm-opt, and wasm-bindgen-cli for web release, or only bevy_cli for other platforms
well i'm only assuming
$ cargo binstall a b c
INFO resolve: Resolving package: 'a'
INFO resolve: Resolving package: 'b'
INFO resolve: Resolving package: 'c'
ERROR Fatal error:
Γ For crate a: no binaries specified nor inferred
β°ββΆ no binaries specified nor inferred
based on this
anyways web release is already faster than the other platforms, no need to micro-optimize it
Why is getrandom an optional dep?
Oh wait
Yeah I see
Bit confused about why we need the getrandom feature
On my machine, it was always enough to set the rustflag 
i think you may not have actually hit the bug?
when i pulled in bevy_seedling i started hitting the bug despite using the previous workaround
this setup is what ended up fixing it for me
you get a compilation error if the rustflag is set without the feature enabled
Could we also just specify the dependency unconditionally for the wasm target?
that might work
That has never happened to me
I is there an open issue for getrandom?
Because IIRC according to them, itβs either one or the other
well here's an example of someone else hitting the compilation error: https://github.com/rustwasm/wasm-bindgen/issues/4422
yeah because their build targetting wasm would have the feature enabled presumably
Edit suggests they also donβt need the feature
not necessarily
Fair enough
i did also hit the error specifically with bevy_cli trying to install wasm-bindgen-cli (before adding the pre-binstall)
but also with my own crate before enabling the feature
@violet osprey am I just misremembering stuff? Are you supposed to set the rustflag or the rustflag + the cargo feature?
here's the job output: https://github.com/benfrankel/pyri_new_jam/actions/runs/15235143471/job/42847946063
I believe you, I'm just very confused about how this horrid design is supposed to work
yeah..
i will try the cfg setup though, i imagine that would also work
btw here's the release workflow before speedup:
and after:
i think the only factor here is -Zshare-generics=y -Zthreads=0
:/
Check web fails now because it enables the feature but not the cfg
previously it was succeeding because it enabled neither which is.. also wrong i guess?
okay what behavior do we even want?
all web builds / checks should enable both the feature and the cfg?
no RUSTFLAGS merging is insane actually
About >25% down, nice!
Lol
hmm you can't set rustflags in Cargo.toml, it has to be in .cargo/config.toml, but that's supposed to be configured by the user, not the template
so we can't really set rustflags for the user's cargo / bevy commands
unless we start providing an actual .cargo/config.toml
we could move .cargo/config_fast_builds.toml to .cargo/config.toml and only leave the getrandom fix uncommented
