nixfmt icon indicating copy to clipboard operation
nixfmt copied to clipboard

Improve performance

Open piegamesde opened this issue 6 months ago • 3 comments

From https://github.com/NixOS/nixfmt/issues/329#issuecomment-3241760401(CC @wolgangwalther)

We currently do run nixfmt as a separate process in the nixpkgs scripts that use hackage2nix / cabal2nix. But doing so on hackage-packages.nix takes 20 seconds.

20 seconds for formatting a single (albeit excessively large) file is obscene. It is time that we finally take benchmarks and performance optimizations more seriously. Unfortunately this requires some advanced Haskell knowledge.

#234 was a first improvement in that direction, CC @MangoIV would you be interested in contributing more optimizations?

piegamesde avatar Sep 01 '25 12:09 piegamesde

Yes I would, but I'm only slowly coming back to open source and I'm not sure how far this will be up my priorities. Could be fun to hack on it during a weekend though :)

MangoIV avatar Sep 01 '25 12:09 MangoIV

I have worked a bit on this and got a 2x speed up with 1/4 of memory usage. I think there's still some low hanging fruit though, will open a draft PR soon.

MangoIV avatar Oct 23 '25 17:10 MangoIV

#350

MangoIV avatar Oct 23 '25 23:10 MangoIV