nix-builder: cut down eval time by 31.5% - #845
Merged
Merged
Conversation
danieldk
marked this pull request as ready for review
September 24, 2026 10:01
sayakpaul
approved these changes
Sep 24, 2026
Comment on lines
+1
to
+6
| { | ||
| lib, | ||
| stdenv, | ||
| fetchurl, | ||
| unzip, | ||
| }: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I did some profiling of the build of ReLU (since it compiles with all backends) and found and fixed two hot spots:
pandocpackage is used by a lot of packages to convert docs. However, pandoc is written in Haskell and evaluation ofpandocevaluates a large number of packages in the Haskell package set. Resolve this by overridingpandocwith a different derivation that packages precompiled pandoc binaries. This cuts out the Haskell dependencies, removing 9.3s from the 42.6s of eval time.Cargo.lockusingimportCargoLock. This creates a lot of derivations (fetchurlfor every crate). We prefer this overcargoHash, because it'd require updating the hash every time we make a change that touchesCargo.lock. However, we did this relatively expensive eval two times, once forkernel-builderand once forkernels. Avoid the additional evaluation by sharing the same thunk between both derivations. This removes 4.1s from the 42.6s evaluation time.Overview of the total savings:
pandocfrom upstream binariesimportCargoLock