Should I enable nix.autoOptimiseStore on my laptop?

Back in 2012, Nix’ autoOptimiseStore setting was set to false to avoid a performance problem. That seems to be what it’s still defaulting to today:

The corresponding NixOS option nix.autoOptimiseStore seems to have also defaulted to false ever since it was introduced in

Is there still a good reasons for these defaults today? On my laptop, where I’ve made it a habit to run

nix-store --optimize

after every other or third nixos-rebuild, is there anything to consider before setting nix.autoOptimiseStore to true instead of continuing to manually invoke nix-store --optimize every now and then?

I have it on without any apparent issues.

I have it enabled and it saves 8818.67 MiB. I’ve never noticed any practical drawback from it.

I have it active, and I have to be honest, there is a noticeable slow down on write operations in the store.

Getting a nixpkgs “checkout” into the store takes about 30 seconds when I have nix.autoOptimiseStore enabled, though its 5 to 10 when disabled.

Note that it needs to checksum the files but even then that seems like a huge difference. Either the checksumming is super slow or your fs can’t handle the large directory of hardlinks. What fs are you using, and SSD or HDD?

ZFS with compression and dedup for that dataset. Though I have activated dedup only recently, it was not active when wrote my last post.

Drive is an SSD (Samsung QVO, 1 TB)

Hmm, that’s quite a slow drive for random writes. Perhaps the hardlinks are causing way more fragmented writes? There are a ton of small files in nixpkgs.

In any case, doesn’t seem like an easy-to-diagnose issue.

I checked and nix doesn’t seem to combine the checksumming with other operations. So it causes extra reads and writes.