1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-25 03:39:36 +01:00

libfetchers: Improve compile times with PCH

(Before)

**** Time summary:
Compilation (17 times):
  Parsing (frontend):           72.3 s
  Codegen & opts (backend):     47.8 s

(After)

Compilation (19 times):
  Parsing (frontend):           27.5 s
  Codegen & opts (backend):     43.8 s
This commit is contained in:
Sergei Zimmerman 2025-08-17 00:57:14 +03:00
parent f13aeaf2f1
commit 347ed8d9ba
No known key found for this signature in database
3 changed files with 5 additions and 1 deletions

View file

@ -292,7 +292,7 @@ void Fetch::fetch(
auto authIt = headerIt->find("Authorization"); auto authIt = headerIt->find("Authorization");
if (authIt == headerIt->end()) if (authIt == headerIt->end())
return std::nullopt; return std::nullopt;
return *authIt; return std::string(*authIt);
}(); }();
const uint64_t size = obj.at("size"); const uint64_t size = obj.at("size");
sizeCallback(size); sizeCallback(size);

View file

@ -66,6 +66,7 @@ this_library = library(
link_args : linker_export_flags, link_args : linker_export_flags,
prelink : true, # For C++ static initializers prelink : true, # For C++ static initializers
install : true, install : true,
cpp_pch : do_pch ? [ 'pch/precompiled-headers.hh' ] : [],
) )
install_headers(headers, subdir : 'nix/fetchers', preserve_path : true) install_headers(headers, subdir : 'nix/fetchers', preserve_path : true)

View file

@ -0,0 +1,3 @@
#include "nix/fetchers/fetchers.hh"
#include "nix/store/store-api.hh"
#include "nix/util/json-utils.hh"