From: Miklos Vajna Date: Mon, 09 Jun 2008 23:35:09 GMT Subject: Re: [PATCH] Introduce get_octopus_merge_bases() in commit.c Message-ID: <20080609233509.GW29404@genesis.frugalware.org> In-Reply-To: <7vy75edwlx.fsf@gitster.siamese.dyndns.org> On Mon, Jun 09, 2008 at 04:20:10PM -0700, Junio C Hamano wrote: > > struct commit_list list = { two, NULL }; > > > > merge_bases_many(one, &list); > > But (1) that is not what f755fb6 does; it does commit_list_insert() that > has an allocation, and (2) how much work is to count, allocate and pass > array for slow and less frequent codepath which octopus-merge-base is? If (1) is the only problem, I can do it the way Dscho suggested, but I don't exactly see why using a commit_list* can slow merge_bases() down: for (i = 0; i < n; i++) { ... } is probably as fast as for (i = list; i; i = i->next) { ... } in case n = 0 / list->next is NULL.