-
-
Notifications
You must be signed in to change notification settings - Fork 621
Description
While putting fastfetch 2.14 on a slower laptop of mine i noticed that my implementation for package counts for guix is quite slow taking 60-70ms for each of the 3 profiles on my main machine and up to 2-3x that on a slow laptop.
The main cause for this is waiting for guile to return the list of installed packages.
I have taken a look at what is happening behind the scenes:
- The
-Iflag ofguix packagecalls thelist-installedfunction from here. - Which then uses
profile-manifest(from here) to read and parse the manifest of the profile atPROFILE/manifest.
This manifest files currently look like this:
(manifest
(version 4)
(packages
(("emacs"
"29.3"
"out"
"/gnu/store/1bi7n031g6b5b07hvps3gyi0rhi44qkb-emacs-29.3"
;; ...
)
("fastfetch"
"2.14.0"
"out"
"/gnu/store/kamkxrxi8mdcfagfg0z4nfranhfn8csb-fastfetch-2.14.0"
;; ...
)
("btop"
"1.3.2"
"out"
"/gnu/store/0j1ya0g65nk613lnq56dyhnv4fk8blvb-btop-1.3.2")
;; .....
)))(Somtimes there is additional information for a package like search paths, propagated packages or provenance information, etc which I have omitted here for clarity)
All that gets displayed using guix package -I are the entries in the packages list.
Would it be possible to parse this file with C instead? Are there any other examples I could look at which do something similiar?
EDIT:
The thing that I tried was using GetNumStrings for "/gnu/store/" but that also catches additional entries from the additional fields that i omitted above. But at least it is a lot faster reducing the total time for packages to 4ms