From patchwork Thu Oct 25 23:32:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Beller X-Patchwork-Id: 10656797 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B2D4513A4 for ; Thu, 25 Oct 2018 23:32:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6A852C6E9 for ; Thu, 25 Oct 2018 23:32:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9861D2C6F8; Thu, 25 Oct 2018 23:32:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 457D32C6E9 for ; Thu, 25 Oct 2018 23:32:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727658AbeJZIHX (ORCPT ); Fri, 26 Oct 2018 04:07:23 -0400 Received: from mail-qt1-f202.google.com ([209.85.160.202]:38136 "EHLO mail-qt1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727650AbeJZIHW (ORCPT ); Fri, 26 Oct 2018 04:07:22 -0400 Received: by mail-qt1-f202.google.com with SMTP id b55-v6so11001910qtb.5 for ; Thu, 25 Oct 2018 16:32:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=dKkiRNzxRqU0laEc6xb/t6nsn4iaEPm7vic1aGSiMvA=; b=nApvsjj2CIcdu2pjJtV0C/oQod1qenJqzDfKuJWbDZc9+f8RY+47enLb2MzgsRNWno dgLzuun4I0MtV7NlzA/CCH414MmUkWjsk7VUtdoW8RPgmy4LYIOU64yqmVGzPw5dqb/w tvxZuAShqr7rfHRmImI4dhWC34/ecHHo9sAS4IBa0bK5yOgu3AzGkiaRiWzYZVCsUxOU C8QxmIOInKEgrSuJ9Wz0Y+ISewN/qp5+R0xYQslRFj8mBPKaL7aofUVzDAUDdnsFMQdU 2p9y+yMfTOYKdojnGCVky0A0ja9UXDJLIRzDKjxrZbTL5ADYCR4GD33oT96f7151aThI 6jMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=dKkiRNzxRqU0laEc6xb/t6nsn4iaEPm7vic1aGSiMvA=; b=uHxCVmhIzLAmNiJqfqjU1N89e8PkqLGA1YTAZdZuxGERbk8ApLTWjDI9P4qTede+v0 ZykzTOVZRl8OH8QgGQdXzX+NjV5+vhDWE8/FvyV4ROcOpIhIa1mVc2aZiyAD8tg4E2R/ Eq+1l8jkLPXrpmjbKrMnVpkwbFiNWCpj/IDHZjeAR55wTbTlOHrFqgNLC0jCMF2/zhKt 4u2NC1MgQGYUaozK1LzXDbrluAhqrXletghVVrMsbRoQtBwqi6MshcFnJxGR6oBU6oF6 hGlpdQcUEOI1mTHRkd0GxaHflf1fqW7x2SBTqnO++Za1CkA2DqygXatWqCl0OQnVl0vm IqBA== X-Gm-Message-State: AGRZ1gJr40sSbyfn6Fdxu5w5gtIwyv7i3Nc09i20KlRiEsH4pNDF+nWj lXzY92TjFp6oko0yIrbc5O9SgaaQFEZk X-Google-Smtp-Source: AJdET5d3o5Y5bgqxISd64wz8NcW+HeH1nIhFFx+NgdAlV0cHoL35gcJVOjSdVWQAnRZKTpUoc6DRFZJbcGYF X-Received: by 2002:a37:6082:: with SMTP id u124-v6mr1197501qkb.14.1540510364140; Thu, 25 Oct 2018 16:32:44 -0700 (PDT) Date: Thu, 25 Oct 2018 16:32:24 -0700 In-Reply-To: <20181025233231.102245-1-sbeller@google.com> Message-Id: <20181025233231.102245-4-sbeller@google.com> Mime-Version: 1.0 References: <20181025233231.102245-1-sbeller@google.com> X-Mailer: git-send-email 2.19.0 Subject: [PATCH 03/10] submodule.c: sort changed_submodule_names before searching it From: Stefan Beller To: jonathantanmy@google.com Cc: git@vger.kernel.org, Stefan Beller , Junio C Hamano Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We can string_list_insert() to maintain sorted-ness of the list as we find new items, or we can string_list_append() to build an unsorted list and sort it at the end just once. As we do not rely on the sortedness while building the list, we pick the "append and sort at the end" as it has better worst case execution times. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- submodule.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/submodule.c b/submodule.c index e145ebbb16..9fbfcfcfe1 100644 --- a/submodule.c +++ b/submodule.c @@ -1270,7 +1270,7 @@ static int get_next_submodule(struct child_process *cp, case RECURSE_SUBMODULES_DEFAULT: case RECURSE_SUBMODULES_ON_DEMAND: if (!submodule || - !unsorted_string_list_lookup( + !string_list_lookup( &changed_submodule_names, submodule->name)) continue; @@ -1364,6 +1364,7 @@ int fetch_populated_submodules(struct repository *r, /* default value, "--submodule-prefix" and its value are added later */ calculate_changed_submodule_paths(); + string_list_sort(&changed_submodule_names); run_processes_parallel(max_parallel_jobs, get_next_submodule, fetch_start_failure,