Skip to content

Instantly share code, notes, and snippets.

@Mic92
Created November 25, 2024 11:37
Show Gist options
  • Save Mic92/51ceaec9f5a9b53117710d5f3d9ef6b1 to your computer and use it in GitHub Desktop.
Save Mic92/51ceaec9f5a9b53117710d5f3d9ef6b1 to your computer and use it in GitHub Desktop.
hyperfine --show-output 'rm -R ~/.cache/nix/binary-cache-*.sqlite*; rm -rf /tmp/cache; nix copy --from "{url}" --to "file:///tmp/cache?compression=none" /nix/store/jlkypcf54nrh4n6r0l62ryx93z752hb2-firefox-132.0' -L url https://nixos.tvix.store,https://cache.nixos.org/
Benchmark 1: rm -R ~/.cache/nix/binary-cache-*.sqlite*; rm -rf /tmp/cache; nix copy --from "https://nixos.tvix.store" --to "file:///tmp/cache?compression=none" /nix/store/jlkypcf54nrh4n6r0l62ryx93z752hb2-firefox-132.0
  Time (mean ± σ):      5.090 s ±  0.113 s    [User: 4.721 s, System: 2.555 s]
  Range (min … max):    4.942 s …  5.332 s    10 runs

Benchmark 2: rm -R ~/.cache/nix/binary-cache-*.sqlite*; rm -rf /tmp/cache; nix copy --from "https://cache.nixos.org/" --to "file:///tmp/cache?compression=none" /nix/store/jlkypcf54nrh4n6r0l62ryx93z752hb2-firefox-132.0
  Time (mean ± σ):      6.729 s ±  0.148 s    [User: 15.829 s, System: 2.904 s]
  Range (min … max):    6.560 s …  7.049 s    10 runs

Summary
  rm -R ~/.cache/nix/binary-cache-*.sqlite*; rm -rf /tmp/cache; nix copy --from "https://nixos.tvix.store" --to "file:///tmp/cache?compression=none" /nix/store/jlkypcf54nrh4n6r0l62ryx93z752hb2-firefox-132.0 ran
    1.32 ± 0.04 times faster than rm -R ~/.cache/nix/binary-cache-*.sqlite*; rm -rf /tmp/cache; nix copy --from "https://cache.nixos.org/" --to "file:///tmp/cache?compression=none" /nix/store/jlkypcf54nrh4n6r0l62ryx93z752hb2-firefox-132.0
hyperfine --show-output  -L url   205.60s user 54.66s system 219% cpu 1:58.35 total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment