Reduce substitution memory consumption
copyStorePath() now pipes the output of srcStore->narFromPath() directly into dstStore->addToStore(). The sink used by the former is converted into a source usable by the latter using boost::coroutine2. This is based on [1]. This reduces the maximum resident size of $ nix build --store ~/my-nix/ /nix/store/b0zlxla7dmy1iwc3g459rjznx59797xy-binutils-2.28.1 --substituters file:///tmp/binary-cache-xz/ --no-require-sigs from 418592 KiB to 53416 KiB. (The previous commit also reduced the runtime from ~4.2s to ~3.4s, not sure why.) A further improvement will be to download files into a Sink. [1] https://github.com/NixOS/nix/compare/master...Mathnerd314:dump-fix-coroutine#diff-dcbcac55a634031f9cc73707da6e4b18 Issue #1969.
Showing
- src/libstore/local-store.cc 22 additions, 12 deletionssrc/libstore/local-store.cc
- src/libstore/local-store.hh 1 addition, 1 deletionsrc/libstore/local-store.hh
- src/libstore/store-api.cc 28 additions, 21 deletionssrc/libstore/store-api.cc
- src/libstore/store-api.hh 6 additions, 1 deletionsrc/libstore/store-api.hh
- src/libutil/local.mk 1 addition, 1 deletionsrc/libutil/local.mk
- src/libutil/serialise.cc 63 additions, 0 deletionssrc/libutil/serialise.cc
- src/libutil/serialise.hh 23 additions, 0 deletionssrc/libutil/serialise.hh
- src/nix-daemon/nix-daemon.cc 1 addition, 1 deletionsrc/nix-daemon/nix-daemon.cc
Loading
Please register or sign in to comment