From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: "git\@vger.kernel.org" <git@vger.kernel.org>,
Jens Lehmann <Jens.Lehmann@web.de>
Subject: Re: [PATCH 1/2] submodule--helper: initial clone learns retry logic
Date: Thu, 09 Jun 2016 13:40:59 -0700 [thread overview]
Message-ID: <xmqqlh2egko4.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <xmqqtwh2gmlv.fsf@gitster.mtv.corp.google.com> (Junio C. Hamano's message of "Thu, 09 Jun 2016 12:59:08 -0700")
Junio C Hamano <gitster@pobox.com> writes:
> Stefan Beller <sbeller@google.com> writes:
>
>> instead. But that is still unspecified, so we rather go with
>>
>> static int compare_ce(const void *one, const void *two, void *cb_data)
>> {
>> const struct cache_entry *ce_one = one, *ce_two = two;
>> return strcmp(ce_one->name, ce_two->name);
>> }
>
> As I said below, I do not think it is worth addressing by making the
> code's behaviour on real systems worse. As long as what you have as
> the key into priority queue is a pointer to cache_entry, you cannot
> make it better from that point of view.
... because having to strcmp() their names would be much more
expensive than the pointer comparison.
However, I think you could use a pointer into a single array as
an element of prio_queue. I notice here:
for (; suc->current < suc->list.nr; suc->current++) {
- const struct cache_entry *ce = suc->list.entries[suc->current];
+ ce = suc->list.entries[suc->current];
if (prepare_to_clone_next_submodule(ce, child, suc, err)) {
+ *ce_task_cb = (struct cache_entry *) ce;
suc->current++;
return 1;
}
}
that list.entries[] can serve as such an array. If you pass around
the pointer to its element instead, i.e.
- ce = suc->list.entries[suc->current];
+ ceP = &suc->list.entries[suc->current];
- if (prepare_to_clone_next_submodule(ce, child, suc, err)) {
+ if (prepare_to_clone_next_submodule(*ceP, child, suc, err)) {
+ *ce_task_cb = (struct cache_entry *) ce;
- *ce_task_cb = ceP;
...
}
/*
* The loop above tried cloning each submodule once,
* now try the stragglers again.
*/
- ce = (struct cache_entry *) prio_queue_get(&suc->failed_queue);
+ ceP = (struct cache_entry **) prio_queue_get(&suc->failed_queue);
then the elements you are pushing into prio-queue would not be ce
(pointer to a cache entry), but would be a pointer of an array that
holds many pointers to cache entries, so it becomes kosher to
compare them for ordering.
That would probably not add too much overhead at runtime; it may
have to involve a bit of code restructuring, so I do not know if it
is worth it, though.
next prev parent reply other threads:[~2016-06-09 20:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-09 19:06 [PATCH 0/2] Dealing with a lot of submodules Stefan Beller
2016-06-09 19:06 ` [PATCH 1/2] submodule--helper: initial clone learns retry logic Stefan Beller
2016-06-09 19:19 ` Junio C Hamano
2016-06-09 19:47 ` Stefan Beller
2016-06-09 19:59 ` Junio C Hamano
2016-06-09 20:40 ` Junio C Hamano [this message]
2016-06-09 23:38 ` Stefan Beller
2016-06-09 19:06 ` [PATCH 2/2] submodule update: continue when a clone fails Stefan Beller
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqlh2egko4.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=Jens.Lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=sbeller@google.com \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.