unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Christopher Baines <mail@cbaines.net>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] git-download: Speed up 'git-predicate'.
Date: Wed, 21 Jun 2017 23:17:02 +0200	[thread overview]
Message-ID: <87shitghwx.fsf@gnu.org> (raw)
In-Reply-To: <ccd33471-7990-df46-a460-0dac9f5ed12c@cbaines.net> (Christopher Baines's message of "Mon, 19 Jun 2017 08:24:24 +0100")

Hi!

Christopher Baines <mail@cbaines.net> skribis:

> On 07/06/17 13:52, Ludovic Courtès wrote:
>> Christopher Baines <mail@cbaines.net> skribis:

[...]

>> Do you know how much the inode optimization vs. the tree structure
>> contributes to the performance.
>
> I've got some more data. I ran the test script for smart-answers, and
> let it complete this time:
>
>   real    97m21.291s
>   user    120m50.400s
>   sys     0m31.020s
>
> Just applying the inode optimization gives this result:
>
>   real    90m28.116s
>   user    100m44.784s
>   sys     0m18.524s
>
> I'm going to assume that using the tree structure for directories makes
> up the rest of the difference. This will vary between repositories
> though, I think smart answers has a unusually large directory to file ratio.

Interesting, thanks for benchmarking!

>> Likewise, the (map car …) call for ‘match’.  :-)
>
> I'm stuck on this bit though, in the latest patch it reads:
>
>   (list? (member top-directory (map car tree))
>
> The list? call is just to turn the list or #f returned by member to #t
> or #f. The (map car tree) converts the tree to a list of top level
> directories. This bit of code is used when the last directory in the
> input list has been reached (e.g. when checking for foo/bar/baz
> top-directory would be baz) so the last check to perform is to check if
> baz exists at the current level of the tree. Any suggestions on
> restructuring this?

Probably:

  (match tree
    (((heads . _) ...)
     (->bool (member top-directory heads))))

>>> +         (inodes-vhash   (alist->vhash
>>> +                          (map
>>> +                           (lambda (file)
>>> +                             (let ((stat
>>> +                                    (lstat (string-append directory "/" file))))
>>> +                               (cons (stat:ino stat) (stat:dev stat))))
>>> +                           files)))
>> 
>> I would call it ‘inodes’ simply.  Also, we could use ‘list->set’ from
>> (guix sets) here.
>
> I've made the inodes-vhash -> inodes rename, but I was undecided about
> using (guix sets), is there a reason you recommended it?

Because conceptually it’s a set: what we want to know is whether the set
contains a given inode/device pair.

I’ll comment on v2 of the patch.

Thank you,
Ludo’.

      reply	other threads:[~2017-06-21 21:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-02  7:08 [PATCH] git-download: Speed up 'git-predicate' Christopher Baines
2017-06-02  7:34 ` Christopher Baines
2017-06-07 12:40   ` Ludovic Courtès
2017-06-07 18:12     ` Christopher Baines
2017-06-07 12:52 ` Ludovic Courtès
2017-06-08 20:43   ` Christopher Baines
2017-06-19  7:14   ` Christopher Baines
2017-06-21 21:44     ` Ludovic Courtès
2017-07-16 10:42       ` Christopher Baines
2017-07-25 21:26         ` Ludovic Courtès
2017-07-26  9:58           ` Christopher Baines
2017-06-19  7:24   ` Christopher Baines
2017-06-21 21:17     ` Ludovic Courtès [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87shitghwx.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=mail@cbaines.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).