-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use YAML for config #352
Use YAML for config #352
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good so far. Can we improve the OmConfig::get
interface so as to resolve and avoid unnecessary nix
command runs? See #339 (comment)
Aren’t those omnix/crates/omnix-develop/src/core.rs Lines 45 to 57 in af87950
|
Fixed in 1b7c152. ❯ just run develop --stage post-shell .
cargo run -p omnix-cli develop --stage post-shell .
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.28s
Running `target/debug/om develop --stage post-shell .`
⌨️ Preparing to develop project: .
🍾 Welcome to the omnix project
To run omnix,
────────────────────
just watch <args>
────────────────────
(Now, as you edit the Rust sources, the above will reload!)
🍎🍎 Run 'just' to see more commands. See https://nixos.asia/en/vscode for IDE setup. |
Did a benchmark of running both ❯ nix run github:nixos/nixpkgs/nixpkgs-unstable#hyperfine -- --warmup 10 './with-yaml/bin/om develop --stage pre-shell . && ./with-yaml/bin/om develop --stage post-shell .' './without-yaml/bin/om develop --stage pre-shell . && ./without-yaml/bin/om develop --stage post-shell .'
Benchmark 1: ./with-yaml/bin/om develop --stage pre-shell . && ./with-yaml/bin/om develop --stage post-shell .
Time (mean ± σ): 208.7 ms ± 3.7 ms [User: 6.6 ms, System: 2.3 ms]
Range (min … max): 203.5 ms … 216.7 ms 14 runs
Benchmark 2: ./without-yaml/bin/om develop --stage pre-shell . && ./without-yaml/bin/om develop --stage post-shell .
Time (mean ± σ): 603.8 ms ± 6.9 ms [User: 93.0 ms, System: 92.1 ms]
Range (min … max): 592.2 ms … 612.5 ms 10 runs
Summary
./with-yaml/bin/om develop --stage pre-shell . && ./with-yaml/bin/om develop --stage post-shell . ran
2.89 ± 0.06 times faster than ./without-yaml/bin/om develop --stage pre-shell . && ./without-yaml/bin/om develop --stage post-shell . Here are individual outputs of ❯ ./with-yaml/bin/om develop --stage pre-shell . && ./with-yaml/bin/om develop --stage post-shell .
⌨️ Preparing to develop project: .
❄️ nix --accept-flake-config --version️
❄️ nix --extra-experimental-features nix-command --accept-flake-config show-config --json️
✅ Nix environment is healthy.
⌨️ Preparing to develop project: .
🍾 Welcome to the omnix project
To run omnix,
────────────────────
just watch <args>
────────────────────
(Now, as you edit the Rust sources, the above will reload!)
🍎🍎 Run 'just' to see more commands. See https://nixos.asia/en/vscode for IDE setup. ❯ ./without-yaml/bin/om develop --stage pre-shell . && ./without-yaml/bin/om develop --stage post-shell .
❄️ nix --accept-flake-config --version️
❄️ nix --extra-experimental-features nix-command --accept-flake-config show-config --json️
❄️ nix --accept-flake-config eval '.#om' --json️
⌨️ Preparing to develop project: .
✅ Nix environment is healthy.
❄️ nix --accept-flake-config --version️
❄️ nix --extra-experimental-features nix-command --accept-flake-config show-config --json️
❄️ nix --accept-flake-config eval '.#om' --json️
⌨️ Preparing to develop project: .
🍾 Welcome to the project
(Want to show custom instructions here? Add them to the om.develop.default.readme field in your flake.nix file) |
The above numbers are from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great
Sure, I'll merge this in the meanwhile. |
Using YAML config is 14 times faster than flake config in Nammayatri on |
On MBP M1 pro it is ~10x faster: nammayatri on main via 🐍 v2.7.9 took 4s
❯ nix run github:nixos/nixpkgs/nixpkgs-unstable#hyperfine -- --warmup 10 './with-yaml/bin/om develop --stage pre-shell . && ./with-yaml/bin/om develop --stage post-shell .' './without-yaml/bin/om develop --stage pre-shell . && ./without-yaml/bin/om develop --stage post-shell .'
Benchmark 1: ./with-yaml/bin/om develop --stage pre-shell . && ./with-yaml/bin/om develop --stage post-shell .
Time (mean ± σ): 185.6 ms ± 3.7 ms [User: 6.2 ms, System: 2.7 ms]
Range (min … max): 178.6 ms … 193.8 ms 15 runs
Benchmark 2: ./without-yaml/bin/om develop --stage pre-shell . && ./without-yaml/bin/om develop --stage post-shell .
Time (mean ± σ): 1.781 s ± 0.058 s [User: 0.399 s, System: 0.326 s]
Range (min … max): 1.716 s … 1.922 s 10 runs
Summary
./with-yaml/bin/om develop --stage pre-shell . && ./with-yaml/bin/om develop --stage post-shell . ran
9.59 ± 0.37 times faster than ./without-yaml/bin/om develop --stage pre-shell . && ./without-yaml/bin/om develop --stage post-shell . |
Clearly an improvement. Let's hope |
resolves #343
If the flake url is a local path and
om.yaml
exists in the project root,omnix
will not invokenix eval .#om
.Benchmarked
om develop —pre-shell . && om develop —post-shell .
in https://github.com/nammayatri/nammayatri, using YAML config is 14 times faster:om.yaml
used for the benchmark: