Now for a single-package ‘warmed up’ test, and some cleanup on both sides to see what the total installed size looks like after autoremoval of orphaned dependencies, build-time dependencies, etc.

Installing one package with Homebrew, where the whole dependency closure is bottled, no building from source:

~
time brew install graphicsmagick
==> Downloading https://ghcr.io/v2/linuxbrew/core/libxfixes/manifests/5.0.3
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/linuxbrew/core/libxfixes/blobs/sha256:3aaba846570380f7dbf5cf7f93280866318a7730c9c5fd38fd1ad275aec037bd
<snip>
==> Pouring freeglut--3.2.1_5.x86_64_linux.bottle.tar.gz
/home/linuxbrew/.linuxbrew/Cellar/freeglut/3.2.1_5: 20 files, 1.3MB
==> Installing graphicsmagick dependency: jasper
==> Pouring jasper--2.0.32.x86_64_linux.bottle.tar.gz
/home/linuxbrew/.linuxbrew/Cellar/jasper/2.0.32: 40 files, 1.1MB
==> Installing graphicsmagick
==> Pouring graphicsmagick--1.3.36.x86_64_linux.bottle.tar.gz
/home/linuxbrew/.linuxbrew/Cellar/graphicsmagick/1.3.36: 497 files, 14.7MB

________________________________________________________
Executed in 362.04 secs fish external
usr time 56.32 secs 603.00 micros 56.32 secs
sys time 20.00 secs 383.00 micros 20.00 secs

Installing the same package with Nix:

~
time nix profile install nixpkgs#graphicsmagick

________________________________________________________
Executed in 11.58 secs fish external
usr time 701.80 millis 500.00 micros 701.30 millis
sys time 310.06 millis 319.00 micros 309.74 millis

So in terms of time, they're not really in the same ballpark. Nix is operating in ‘wait a few seconds’ time, and Homebrew is operating in ‘go make yourself a cup of coffee and come back’ time.

And after running `brew cleanup` and `brew autoremove`, then `nix-collect-garbage` and `nix-store --optimize`:

~
du -hsxc /nix/store /home/linuxbrew
1.9G /nix/store
3.9G /home/linuxbrew
5.8G total

Listing installed packages now:

~
time brew list
==> Formulae
aom fontconfig imagemagick libelf libmpc libx11 libxshmfence mesa-glu python@3.9 xinput
bat freeglut imath libev libomp libxau libxslt mpdecimal readline xmlto
binutils freetype imlib2 libexif libpciaccess libxcb libxt mpfr rtmpdump xorgproto
bison gcc isl libffi libpng libxdamage libxv mruby ruby xz
brotli gdbm jasper libgcrypt libpthread-stubs libxdmcp libxvmc ncurses shared-mime-info zlib
bzip2 gettext jbig2dec libgpg-error libsm libxext libxxf86vm nghttp2 sqlite zstd
c-ares ghostscript jemalloc libheif libssh2 libxfixes libyaml openexr unzip
curl giflib jpeg libice libtiff libxi little-cms2 openjpeg util-linux
docbook glib krb5 libidn libtool libxinerama llvm openldap wayland
docbook-xsl gmp libde265 libidn2 libunistring libxml2 lm-sensors openssl@1.1 wayland-protocols
expat gnu-getopt libdrm liblqr libva libxrandr m4 pcre webp
feh graphicsmagick libedit libmetalink libvdpau libxrender mesa pkg-config x265

________________________________________________________
Executed in 580.23 millis fish external
usr time 478.15 millis 0.00 micros 478.15 millis
sys time 108.59 millis 759.00 micros 107.83 millis

~
time nix profile list
0 flake:nixpkgs#legacyPackages.x86_64-linux.imagemagick github:NixOS/nixpkgs/b2f2d04f01b3de3abad0dd9bc48ad7a3ee32bbc6#legacyPackages.x86_64-linux.imagemagick /nix/store/5ps3bydsjiqgycbzg2cxkwyz50m4rga7-imagemagick-7.0.11-6
1 flake:nixpkgs#legacyPackages.x86_64-linux.bat github:NixOS/nixpkgs/b2f2d04f01b3de3abad0dd9bc48ad7a3ee32bbc6#legacyPackages.x86_64-linux.bat /nix/store/0lyhwrmf3nbadavaq3ixfndhiaw3b86l-bat-0.18.0
2 flake:nixpkgs#legacyPackages.x86_64-linux.feh github:NixOS/nixpkgs/b2f2d04f01b3de3abad0dd9bc48ad7a3ee32bbc6#legacyPackages.x86_64-linux.feh /nix/store/sy0xxs6lbvwhidg5dlj6ckwik2mn3b6l-feh-3.6.3
3 flake:nixpkgs#legacyPackages.x86_64-linux.crystal github:NixOS/nixpkgs/b2f2d04f01b3de3abad0dd9bc48ad7a3ee32bbc6#legacyPackages.x86_64-linux.crystal /nix/store/fbnk8kwbllsn2m60d43y2cfqpwbw5pk4-crystal-1.0.0
4 flake:nixpkgs#legacyPackages.x86_64-linux.python github:NixOS/nixpkgs/b2f2d04f01b3de3abad0dd9bc48ad7a3ee32bbc6#legacyPackages.x86_64-linux.python /nix/store/pp0fp5zds7wqhyx6zqnnxl2aqzf4a51r-python-2.7.18
5 flake:nixpkgs#legacyPackages.x86_64-linux.graphicsmagick github:NixOS/nixpkgs/b2f2d04f01b3de3abad0dd9bc48ad7a3ee32bbc6#legacyPackages.x86_64-linux.graphicsmagick /nix/store/fm7fa16blb4xadsxxagxy0vfmhrjqns0-graphicsmagick-1.3.36

________________________________________________________
Executed in 25.18 millis fish external
usr time 18.24 millis 452.00 micros 17.79 millis
sys time 9.17 millis 279.00 micros 8.89 millis

Nix's output is a mess, visually, and that'll change in the future. But note that it doesn't bother me with the whole dependency closure, and instead tracks what I actually wanted to install.

Finally, a removal test. I'll uninstall everything but graphicsmagick, with both package managers.

time brew remove imagemagick bat feh python mruby
Error: Refusing to uninstall /home/linuxbrew/.linuxbrew/Cellar/python@3.9/3.9.5
because it is required by freeglut, glib, graphicsmagick, jasper, libheif, liblqr, llvm, mesa, mesa-glu and shared-mime-info, which are currently installed.
You can override this and force removal with:
brew uninstall --ignore-dependencies imagemagick bat feh python mruby

Oops. A second try, since Homebrew put me in dependency hell because it doesn't know the difference between what's installed as a dependency and what I explicitly asked it to install (I thought this functionality was needed to implement `brew autoremove`??).

~
time brew remove --ignore-dependencies imagemagick bat feh python mruby
Uninstalling /home/linuxbrew/.linuxbrew/Cellar/imagemagick/7.0.11-13_2... (805 files, 31.4MB)
Uninstalling /home/linuxbrew/.linuxbrew/Cellar/bat/0.18.1... (12 files, 5.5MB)
Uninstalling /home/linuxbrew/.linuxbrew/Cellar/feh/3.7... (26 files, 716.9KB)
Uninstalling /home/linuxbrew/.linuxbrew/Cellar/python@3.9/3.9.5... (2,650 files, 76.9MB)
Uninstalling /home/linuxbrew/.linuxbrew/Cellar/mruby/3.0.0... (323 files, 14.7MB)

________________________________________________________
Executed in 1.11 secs fish external
usr time 874.06 millis 420.00 micros 873.64 millis
sys time 224.91 millis 261.00 micros 224.65 millis

~
time brew autoremove
<snip>
Uninstalling /home/linuxbrew/.linuxbrew/Cellar/libgpg-error/1.42... (48 files, 1.8MB)

________________________________________________________
Executed in 3.35 secs fish external
usr time 2.51 secs 424.00 micros 2.51 secs
sys time 0.82 secs 261.00 micros 0.82 secs

Nice and fast. :)

Now for Nix:

~
time begin
nix profile remove '.\*'
nix profile install nixpkgs#graphicsmagick
end

________________________________________________________
Executed in 2.99 secs fish external
usr time 499.04 millis 871.00 micros 498.17 millis
sys time 126.67 millis 527.00 micros 126.14 millis

Not as fast, because I garbage-collected the evaluation of Nixpkgs itself, so it fetched and re-evaluated that. (Also I did this in a weird way because the UI for the `nix profile` command is incomplete and still kinda clunky.)

I also need to clean up with Nix:

~
time nix-collect-garbage -d
removing old generations of profile /nix/var/nix/profiles/per-user/pxc/profile
removing generation 49
<snip>
deleting '/nix/store/znvl3v02hy8ffkhwc6m9z1q5pj8j6ppj-setup-hook.sh'
deleting '/nix/store/trash'
deleting unused links...
note: currently hard linking saves -1.14 MiB
188 store paths deleted, 1574.20 MiB freed

________________________________________________________
Executed in 1.23 secs fish external
usr time 14.30 millis 160.00 micros 14.14 millis
sys time 10.70 millis 96.00 micros 10.60 millis

And after cleanup, the usage:
~
du -hsxc /nix/store /home/linuxbrew
412M /nix/store
3.2G /home/linuxbrew
3.6G total

Is there a cleanup command I've missed for Homebrew?

Performance considerations aren't really among my main concerns when it comes to package management, so I didn't mention them in my original post about what's ‘wrong’ with Homebrew. But I'd have to add it now.