Repository navigation
perf(egui): start the boot before the window is built - #137
Conversation
The migration read the split files, then saved the merge: a write landing in between, such as the telemetry id the app sets at launch while the boot thread migrates, was saved over. The read, merge, save and retire now run under the same locks as every other config write.
The boot migrates a pre-1.0 config into two files; reading the geometry between their writes opened the window at the default size. The session thread now starts after the geometry is read, and is joined before the process ends so a close never cuts a migration midway.
start_telemetry read the consent on the UI thread while the boot thread migrated a pre-1.0 config: a read that found neither split file, then the legacy file already retired, got the defaults. The session thread now starts the queue after the boot payload and before the model can report the first boot.
Starting telemetry after the boot payload let the maintenance take the config lock first: a consented profile without an anonymous id waited up to the lock timeout to write it, and the first frame with it. The session thread now migrates a pre-1.0 config right after the legacy web storage read and only then hands that read over, so the UI thread starts telemetry, then the maintenance, in their old order on a migrated config. The boot payload reports the early migration's outcome.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 3 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
This change starts loading the boot data on a background session thread before the window is created, so showing the first window no longer waits for work that could run earlier. It also moves the old single-file config migration earlier and holds the config locks while it runs, so later reads see the migrated result and a concurrent write is not lost. No comments posted: the reviewers raised no finding. Review details
Commands run (11)Could not run tests, build, or app flow: sandbox has no Rust toolchain or C linker ( passed · exit 0 · 0 s cat .github/CONTRIBUTING.md 2>/dev/null | head -n 200; echo "---"; ls crates/*/; echo "---"; cat package.json 2>/dev/null | head -n 50; echo "---"; cat Cargo.toml | head -n 80failed · exit 127 · 0 s cargo test -p accshift-egui early_boot -- --nocapture 2>&1 | tail -n 60failed · exit 2 · 0 s which rustc; ls /root/.cargo/bin/ 2>&1; ls ~/.cargo/bin/ 2>&1; find / -maxdepth 4 -name cargo -type f 2>/dev/null | head; echo PATH=$PATH; cat rust-toolchain* 2>/dev/null; ls /usr/local/cargo/bin/ 2>&1 | headpassed · exit 0 · 0 s ls /usr/local/bin/ 2>&1; echo "---"; ls /opt/ 2>&1; echo "---"; ls /work/ | head -n 30; echo "---"; cat /work/Cargo.toml | head -n 30; echo "---"; env | sort | head -n 30passed · exit 0 · 0 s cat /etc/os-release 2>&1; echo "---"; curl --version 2>&1 | head; echo "---"; wget --version 2>&1 | head; echo "---"; python3 --version 2>&1; echo "---"; df -h 2>&1 | head; echo "---"; free -m 2>&1 | headpassed · exit 0 · 0 s uname -a; df -h /work /tmp 2>&1; ls -la /work/.patrol-home/ 2>&1 | head -n 20
export CARGO_HOME=/tmp/cargo RUSTUP_HOME=/tmp/rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o /tmp/rustup.sh && ls -lh /tmp/rustup.sh && head -n 5 /tmp/rustup.shfailed · exit 127 · 0 s export CARGO_HOME=/tmp/cargo RUSTUP_HOME=/tmp/rustup
sh /tmp/rustup.sh -y --profile minimal --default-toolchain stable 2>&1 | tail -n 20
ls -lh /tmp/cargo/bin/ 2>&1 | head -n 20
/tmp/cargo/bin/cargo --version 2>&1; /tmp/cargo/bin/rustc --version 2>&1passed · exit 0 · 0 s echo "persist-test-work" > /work/.persist_test 2>&1; echo "persist-test-tmp" > /tmp/persist_test 2>&1; ls -lh /work/.persist_test /tmp/persist_test 2>&1; df -h /work /tmp 2>&1; ls /work/ | head -n 20failed · exit 2 · 0 s ls -lh /work/.persist_test /tmp/persist_test 2>&1; ls -lh /tmp/rustup.sh /tmp/cargo 2>&1; echo "---HOME---"; echo $HOME; ls -la $HOME 2>&1 | head -n 20; ls /work/.patrol-home 2>&1 | headpassed · exit 0 · 8 s mkdir -p "$HOME" /work/.cargo /work/.rustup
export CARGO_HOME=/work/.cargo RUSTUP_HOME=/work/.rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o /work/rustup.sh && ls -lh /work/rustup.sh
sh /work/rustup.sh -y --profile minimal --default-toolchain stable 2>&1 | tail -n 30
/work/.cargo/bin/cargo --version 2>&1; /work/.cargo/bin/rustc --version 2>&1; ls /work/.cargo/bin/ 2>&1 | headpassed · exit 0 · 0 s id 2>&1; echo "---"; ls /usr/bin/cc* /usr/bin/gcc* 2>&1; echo "---"; apt --version 2>&1 | head; echo "---"; sudo -n true 2>&1; echo "sudo-exit:$?" |
Note
Clanker Claude Opus 5.5 is responding on behalf of meetsu
Summary
Starts the boot job from
main, before the event loop and the window are built, so the window no longer waits for a boot that started late.What changes
main, right afterbegin_session(log rotation and panic hook stay first).AppModel::realtakes it over as its own boot job; the legacy storage arrives through a channel instead of ajoin.mainjoins the boot thread after the event loop ends, so a close never cuts a migration.presentedmark after the first shown frame, compiled only in the startup bench build, so launch time can be measured as "window visible with content".Measurements
Startup bench build, 14 interleaved runs per exe on Windows 11, hidden window, fresh copy of the app folders per run. Time to the first presented frame, median / p90:
maind94a7f2About 90 to 100 ms pass before
main(loader, executable size, Windows reputation checks on an unsigned exe), which code inside the app cannot reach.Testing
cargo test -p accshift-egui early_boot: 7 passed, includingthe_legacy_read_is_handed_over_once_the_config_is_migrated(red before:the migration was still to come), the telemetry consent read after the migration, a saved window geometry kept through the migration, and a pre-1.0 release folder (legacy config, settings, custom theme) that migrates and boots the same through the early boot and the old boot job, with byte-identical files.config::migrate::race_tests::a_write_racing_the_migration_is_kept: red before the lock fix (left: "",right: "racing-id"), green over 60 runs after.build-safe node scripts/gates.mjs: exit 0, 2064 Rust tests.Related issue
None.
Tested on
Checklist