guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

12/20: squash! Add one variant of each package (name/version pair).


From: guix-commits
Subject: 12/20: squash! Add one variant of each package (name/version pair).
Date: Sun, 4 Jun 2023 17:34:41 -0400 (EDT)

civodul pushed a commit to branch wip-guix-index
in repository guix.

commit 27a5465d7708c8a757d8f0a9fd284093d44f3303
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sun May 21 18:22:05 2023 +0200

    squash! Add one variant of each package (name/version pair).
    
    database goes from 148 MiB -> 52 MiB.
    indexing time goes from 93s to 44s.
---
 guix/scripts/index.scm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/guix/scripts/index.scm b/guix/scripts/index.scm
index c4996815b5..9ba2cccc87 100644
--- a/guix/scripts/index.scm
+++ b/guix/scripts/index.scm
@@ -167,7 +167,7 @@ VALUES (:name, :version, :output);"
 
   (define stmt-select-directory
     (sqlite-prepare db "\
-SELECT id FROM Directories WHERE name = :name AND package = :package;"
+SELECT id FROM Directories WHERE package = :package;"
                     #:cache? #t))
 
   (define stmt-insert-directory
@@ -202,10 +202,13 @@ VALUES (:name, :basename, :directory);"
                  (define (strip file)
                    (string-drop file (+ (string-length directory) 1)))
 
-                 ;; If DIRECTORY is already present in the database, skip it.
+                 ;; If there's already a directory associated with PACKAGE-ID,
+                 ;; not necessarily the same directory, skip it.  That keeps
+                 ;; the database slimmer at the expense of not recording
+                 ;; variants of the same package; it also makes indexing
+                 ;; faster.
                  (sqlite-reset stmt-select-directory)
                  (sqlite-bind-arguments stmt-select-directory
-                                        #:name directory
                                         #:package package-id)
                  (when (null? (sqlite-fold cons '() stmt-select-directory))
                    ;; DIRECTORY is missing so insert it and traverse it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]