From patchwork Mon Oct 19 22:47:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Vandiver X-Patchwork-Id: 11845411 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE69AC433E7 for ; Mon, 19 Oct 2020 22:47:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A144921D7F for ; Mon, 19 Oct 2020 22:47:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fGqxr7Vc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388626AbgJSWrn (ORCPT ); Mon, 19 Oct 2020 18:47:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388622AbgJSWrm (ORCPT ); Mon, 19 Oct 2020 18:47:42 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC10FC0613CE for ; Mon, 19 Oct 2020 15:47:40 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id s9so1468111wro.8 for ; Mon, 19 Oct 2020 15:47:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=0cKnq3ai3qJJvReanp+IwPBsXPj7SOWushngrvWxycE=; b=fGqxr7Vc3U9+ww1Q3udBdiQORK/LflUHzMOJSxXxZnBMcP2/hdFQYg/bkZJ2LTj8c/ oI0+rCN7qrrff2/V9trceP6evYBPNSDc245u9CaCYcQ0Vf7SNTAITaoX3g2sGtOlPg1I M9LsZ1/WcE7cB/sN8HOlm+bFlvEfqdlhJOcdFmCQxXGZMNeWVASE3unfz3sCQNavpQsP mDpMHtglbU3BP8IS5N34dH4bQK+IvUhyEbjKQoj+2ruDwO38mUIMZDXf54rbg6VC63v9 Rh0xENkv9pxT75Y1qHKPYLXzaCdkTmPF4oYSx4COSnx597kadzXb49clMPhy/l8LqMpO swJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=0cKnq3ai3qJJvReanp+IwPBsXPj7SOWushngrvWxycE=; b=Hhe/EZny4BYian+f3NKreycNZOFNAV2gNlwv+TZXqBr9cu/t0yd2cTWBagpI0TFJF3 +BBwSnV4B98L/72z0n35HjdVxXbo4ET9+62zJ54SPVqZHwb0ijJbKUpMbmMaml8cqXj+ mtYNnDPLMSCGnQgSd2j011LYzzxoqTo6bZfmB42WfY+4GHpaf4xsXEkpZYSrAqa0wRZG t3C++Uo5ngUoH5qJC2CfMf7kLevMNOWzx3RxayKh6Mb2BtVkrbfZ7PZdjzEnHinItb3B f7npbrXshp98us5lhnM8vzen5GzevKl1UYWgQ1R5DmhvNTnRuH/5kPD0jRUQ8NI4CG8F jvBg== X-Gm-Message-State: AOAM530u86EIGJhVAZMMnH0Q9AZ6+v6L89uo5vnlbgAW6SjXdQXfRcLh NPwJy/uuGtRcjG5mNRbT6WsifMAf5ZE= X-Google-Smtp-Source: ABdhPJwJZxGodtYNVCahb4j/79z7Yf8qrfOcfYHp2jPKnVW17qeCSiqK14W3UNESWlTQFcUNrdSvDg== X-Received: by 2002:a05:6000:10c6:: with SMTP id b6mr1673639wrx.10.1603147659575; Mon, 19 Oct 2020 15:47:39 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id t5sm1531412wrb.21.2020.10.19.15.47.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Oct 2020 15:47:39 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Mon, 19 Oct 2020 22:47:31 +0000 Subject: [PATCH v3 1/7] fsmonitor: use fsmonitor data in `git diff` Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , Utsav Shah , Nipunn Koorapati , Nipunn Koorapati , Taylor Blau , Nipunn Koorapati , Alex Vandiver Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Alex Vandiver From: Alex Vandiver With fsmonitor enabled, the first call to match_stat_with_submodule calls refresh_fsmonitor, incurring the overhead of reading the list of updated files -- but run_diff_files does not respect the CE_FSMONITOR_VALID flag. Make use of the fsmonitor extension to skip lstat() calls on files that fsmonitor judged as unmodified. Notably, this change improves performance of the git shell prompt when GIT_PS1_SHOWDIRTYSTATE is set. Signed-off-by: Alex Vandiver Signed-off-by: Nipunn Koorapati --- diff-lib.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/diff-lib.c b/diff-lib.c index f95c6de75f..d2d31b9f82 100644 --- a/diff-lib.c +++ b/diff-lib.c @@ -97,6 +97,8 @@ int run_diff_files(struct rev_info *revs, unsigned int option) diff_set_mnemonic_prefix(&revs->diffopt, "i/", "w/"); + refresh_fsmonitor(istate); + if (diff_unmerged_stage < 0) diff_unmerged_stage = 2; entries = istate->cache_nr; @@ -197,8 +199,17 @@ int run_diff_files(struct rev_info *revs, unsigned int option) if (ce_uptodate(ce) || ce_skip_worktree(ce)) continue; - /* If CE_VALID is set, don't look at workdir for file removal */ - if (ce->ce_flags & CE_VALID) { + /* + * When CE_VALID is set (via "update-index --assume-unchanged" + * or via adding paths while core.ignorestat is set to true), + * the user has promised that the working tree file for that + * path will not be modified. When CE_FSMONITOR_VALID is true, + * the fsmonitor knows that the path hasn't been modified since + * we refreshed the cached stat information. In either case, + * we do not have to stat to see if the path has been removed + * or modified. + */ + if (ce->ce_flags & (CE_VALID | CE_FSMONITOR_VALID)) { changed = 0; newmode = ce->ce_mode; } else { From patchwork Tue Oct 20 13:40:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nipunn Koorapati X-Patchwork-Id: 11846973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58720C4363A for ; Tue, 20 Oct 2020 13:41:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E5C1221741 for ; Tue, 20 Oct 2020 13:41:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bBw+UTHy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407564AbgJTNlP (ORCPT ); Tue, 20 Oct 2020 09:41:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407508AbgJTNlK (ORCPT ); Tue, 20 Oct 2020 09:41:10 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84D33C061755 for ; Tue, 20 Oct 2020 06:41:09 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id n6so2179847wrm.13 for ; Tue, 20 Oct 2020 06:41:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=YDGjg72DiBHMJo7ao0V16mKGbZgzL/e6IJE1LLIK85I=; b=bBw+UTHyXojcFqFfUGsruHklH/d3LWkW4xUmpVXjJYNfk0XTCdqwQH5iMbYgo6fO5k MjVkI0jN8QPmrNzw/q7AiBYzRNkSB6TjZ0qeZNqlLec4/g8xJP/9VDXma4+slELKeEbs /MMxjVPDu8KdR28aqGRBBVqvqE2XmD45V7UNDp4qdKjHyXu9XDQ2nJ1LMwB+yGd4BiMJ HCuRv4qAgUYbJieMkGrRXLgnKGtr2dF2RVCPtMmO3arcLqygN2kk0e9GCmGZqMbuGAdz qipWFJafhgY7fRMPS7yjFEV1nyqTrOAGLRpOjC2iJQV42ZzIboFwePM7xt4geBH7a6fz Q/pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=YDGjg72DiBHMJo7ao0V16mKGbZgzL/e6IJE1LLIK85I=; b=OmIoA1uz+1e331f1IQ0Y9seOxdsNc80DJiyFess+qNfMv9ZiZoigmtKRNae3syGSzM Wt+694g72Qn7xLckh72Ufcf5veC3aKkWYduE8Nk8b8Vwz0PnabdtJ2kDoL/eN1O2GH4C C6IlskLXIGxJYP0gwmR6Mh8xZn4zggpgT/HAUzjOm8f8x7clXLtABG7INoBH1WCUzWxK 6tERQpTb7ZyFoLU1vbm0JKDMi0hMXrCiHc/MXmDv30zxrdpfsn8Xnvacz78RyfvYctEg BAfqHKjs7ETIhMCiAGhHiUPrUT9a8BrtgDBPn7FDiNPKftJ7NE2QgMB9eHSNXn/gOvIf Bwlw== X-Gm-Message-State: AOAM531ZMdY6fRou9r5btZlF1F90iwk8V6j48QEHGiVbm/cmXbPFeJ/Z 1NjuODb0Jjz53WPYvzzDbAlKkRmUD34= X-Google-Smtp-Source: ABdhPJyqFPcijN+RX/Cs35CZFW7ljqftgm+8dtVxi3edD8rF8RERzh8+Jt/gISHYKN5+2WnbHDlk9Q== X-Received: by 2002:adf:e643:: with SMTP id b3mr3606539wrn.408.1603201268093; Tue, 20 Oct 2020 06:41:08 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id t6sm3342813wre.30.2020.10.20.06.41.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 06:41:07 -0700 (PDT) Message-Id: <1c7876166f5d9262c44c9df0f613e7d0beb98722.1603201264.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 20 Oct 2020 13:40:59 +0000 Subject: [PATCH v4 2/7] t/perf/README: elaborate on output format Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , Utsav Shah , Nipunn Koorapati , Nipunn Koorapati , Taylor Blau , Nipunn Koorapati , Nipunn Koorapati Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Nipunn Koorapati From: Nipunn Koorapati Signed-off-by: Nipunn Koorapati --- t/perf/README | 2 ++ 1 file changed, 2 insertions(+) diff --git a/t/perf/README b/t/perf/README index bd649afa97..fb9127a66f 100644 --- a/t/perf/README +++ b/t/perf/README @@ -28,6 +28,8 @@ the tests on the current git repository. 7810.3: grep --cached, cheap regex 3.07(3.02+0.25) 7810.4: grep --cached, expensive regex 9.39(30.57+0.24) +Output format is in seconds "Elapsed(User + System)" + You can compare multiple repositories and even git revisions with the 'run' script: From patchwork Mon Oct 19 22:47:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nipunn Koorapati X-Patchwork-Id: 11845409 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80154C433DF for ; Mon, 19 Oct 2020 22:47:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 15EBA21D7F for ; Mon, 19 Oct 2020 22:47:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Oof8SNT0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388630AbgJSWrn (ORCPT ); Mon, 19 Oct 2020 18:47:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388615AbgJSWrm (ORCPT ); Mon, 19 Oct 2020 18:47:42 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7131BC0613D1 for ; Mon, 19 Oct 2020 15:47:42 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id x7so1506849wrl.3 for ; Mon, 19 Oct 2020 15:47:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=Djf3TWO3UFcf03qpN2acJDVn06wf04grB536pabMBck=; b=Oof8SNT0aRcUjUl+MfN0CRXQQUhSWNqOJbr36sM+mqgCOJgvCVLBKWh+H297JLRRL/ LYKOItQbj7NpMRKJfeB07TuHGy2mtR2kK9gUChb7IVZewB4tOmmpxVcY3WgcHFUgrepv 5Z2QYtsMErmF2Bwdbp98AK08SxSwIpZg/rwNv3PJyatECFdZMOdC74jHnLa72pbfvA6e ouqGve3QiJk5aa4A1xPgAXlFn2bZfcFdCqLQmxv525WFUQY7ZjVWLj1EKt+iKg3pv0gs 8soSrKjDQQMegufMeMVvPio+lJx7atXLKDLcmSyYgSmZsNDTfgLQf541UsKBZCOJHE4M B2Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=Djf3TWO3UFcf03qpN2acJDVn06wf04grB536pabMBck=; b=brnIuI954RtYJXpTf6ZuZ8TbjFbQ1uca08w3Anddauhmqhs910kRv8Iq2+CVbBM9wN CXHqqXT6G8o2s9IMOYI+D2JSTNLPQx/7mA1EA6nsGKrIOhKM6MoKYb2wyK7sh5vBdmNr kJTwu7b+h1s1me3/0zrkIgP+p5ZDQBUezQ//W3Mubg1ynL8KHC6v/ZPYOfXrdfPtB7Zh mh8lxMQhegMbgaQnFCHqaoY9nU3D9dizUhxne+J6H/g0m6IIsnYEuBuwnLGeltxXRYHZ UIA87/wvXlUW7oSPbPzR1bxN8I7vD7wzpeJCifK1ppelcvF1aIQpHSZCm0j01MNdK42y QaNA== X-Gm-Message-State: AOAM532p294qnWY1uTO/8CgpmZJpHMa7DTqLZh9byxZOhjiXXuPn9AJM mFmU7QuPTlFS6kw++n/xLYFtm5eTokY= X-Google-Smtp-Source: ABdhPJzqTk5Od5KURV3eNG3atIb61FxzEp0VKRY/wjGzOS0+w7HViS1bmM4IDlFExdPbTMqnqlzGPA== X-Received: by 2002:a05:6000:108:: with SMTP id o8mr1591166wrx.256.1603147661112; Mon, 19 Oct 2020 15:47:41 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id g14sm1386188wrx.22.2020.10.19.15.47.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Oct 2020 15:47:40 -0700 (PDT) Message-Id: <401f696c8156acafd1bf91511fde7ae099ff9052.1603147657.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Mon, 19 Oct 2020 22:47:33 +0000 Subject: [PATCH v3 3/7] t/perf/p7519-fsmonitor.sh: warm cache on first git status Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , Utsav Shah , Nipunn Koorapati , Nipunn Koorapati , Taylor Blau , Nipunn Koorapati , Nipunn Koorapati Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Nipunn Koorapati From: Nipunn Koorapati The first git status would be inflated due to warming of filesystem cache. This makes the results comparable. Before Test this tree -------------------------------------------------------------------------------- 7519.2: status (fsmonitor=.git/hooks/fsmonitor-watchman) 2.52(1.59+1.56) 7519.3: status -uno (fsmonitor=.git/hooks/fsmonitor-watchman) 0.18(0.12+0.06) 7519.4: status -uall (fsmonitor=.git/hooks/fsmonitor-watchman) 1.36(0.73+0.62) 7519.7: status (fsmonitor=) 0.69(0.52+0.90) 7519.8: status -uno (fsmonitor=) 0.37(0.28+0.81) 7519.9: status -uall (fsmonitor=) 1.53(0.93+1.32) After Test this tree -------------------------------------------------------------------------------- 7519.2: status (fsmonitor=.git/hooks/fsmonitor-watchman) 0.39(0.33+0.06) 7519.3: status -uno (fsmonitor=.git/hooks/fsmonitor-watchman) 0.17(0.13+0.05) 7519.4: status -uall (fsmonitor=.git/hooks/fsmonitor-watchman) 1.34(0.77+0.56) 7519.7: status (fsmonitor=) 0.70(0.53+0.90) 7519.8: status -uno (fsmonitor=) 0.37(0.32+0.78) 7519.9: status -uall (fsmonitor=) 1.55(1.01+1.25) Signed-off-by: Nipunn Koorapati --- t/perf/p7519-fsmonitor.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/perf/p7519-fsmonitor.sh b/t/perf/p7519-fsmonitor.sh index def7ecdbc7..9313d4a51d 100755 --- a/t/perf/p7519-fsmonitor.sh +++ b/t/perf/p7519-fsmonitor.sh @@ -114,7 +114,8 @@ test_expect_success "setup for fsmonitor" ' fi && git config core.fsmonitor "$INTEGRATION_SCRIPT" && - git update-index --fsmonitor + git update-index --fsmonitor && + git status # Warm caches ' if test -n "$GIT_PERF_7519_DROP_CACHE"; then From patchwork Mon Oct 19 22:47:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nipunn Koorapati X-Patchwork-Id: 11845419 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED035C433DF for ; Mon, 19 Oct 2020 22:47:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9F31A223FD for ; Mon, 19 Oct 2020 22:47:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kx7YbfWd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388640AbgJSWrq (ORCPT ); Mon, 19 Oct 2020 18:47:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388615AbgJSWro (ORCPT ); Mon, 19 Oct 2020 18:47:44 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9CF7C0613CE for ; Mon, 19 Oct 2020 15:47:43 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id c194so40881wme.2 for ; Mon, 19 Oct 2020 15:47:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=Ty+osmufCYHp5UuwM+HiHearrRr3lEPv9V0tXUxBAZ8=; b=kx7YbfWd4ApOzpQRIyfPn0rxM/jNp16OBC/D8CGummib+DpFSPJSzYtXXWIdxSFRZj A3DNOgKnH0Xrkq5ALj0jLyxVoma64xxXxojo3Mu36YhonfAF4ROZl7DeNUk/aH35fp9j Wat6MoL7KHvRd8xLplH8Dspy8Fu9dPSKjfKyMos0rbnpucVtvtB6TdIICl52DgGZ5FSE TMHNfQXZgcfBr2DiMwb6cXYMnPm6mn0mIWJogiSpqPueGzcwmTssRJZo09CaSYXOyXja ElPRoQf81ImTwKeZzC94ooHnpS7pAykqhqUIV7LHE64XlrN8h3M8ww38UWXesvS9n/FY v/0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=Ty+osmufCYHp5UuwM+HiHearrRr3lEPv9V0tXUxBAZ8=; b=JnreQBtTe3YEBV6cujkpLBRMTWCu5Lx50NnQUckVznQaAfcoiGSMrXum3oeeP+3Dsm tyoViYQ7AnC9i6Fd/21AoOw5/5oWDqDg6iyNb1Y85jI0aZrLZvMKuEerY1i3ep528MYc tdir9z5VqsmTDBgYzxUAfaD2o4FGtsiAFvInSmJeL8cdU1ifoBe+yAIFZpCtUKYO/DaM V1xtFXiurSQ+k7cafmrHmf+RlA8MJw7OkSI8aF4+MU+iqRoTMtlcJvpkOWIPMRoubfEl Zn1spSVgfhJhpgTcGYfpZJZc4cuui3Q4q7bStMGlGX71sPQF2+N4uSE4U926iCVUQPLo iTQw== X-Gm-Message-State: AOAM5316wLsnbyN5njL9qYECubjuwvE12ykIoAFMqNwhPEaNU1GPoAHy eVGX5QVEjs1NfCKegp9zpWQ0ptF3VaA= X-Google-Smtp-Source: ABdhPJzYVj0eBSHymWO4eqOclhsgA161ezqkgu1d87wj+LKnKgPhLkh9FesZzeRUCxDErYtTOJ+Xhg== X-Received: by 2002:a1c:b657:: with SMTP id g84mr104244wmf.0.1603147661926; Mon, 19 Oct 2020 15:47:41 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id a7sm75684wmh.6.2020.10.19.15.47.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Oct 2020 15:47:41 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Mon, 19 Oct 2020 22:47:34 +0000 Subject: [PATCH v3 4/7] t/perf: add fsmonitor perf test for git diff Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , Utsav Shah , Nipunn Koorapati , Nipunn Koorapati , Taylor Blau , Nipunn Koorapati , Nipunn Koorapati Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Nipunn Koorapati From: Nipunn Koorapati Results for the git-diff fsmonitor optimization in patch in the parent-rev (using a 400k file repo to test) As you can see here - git diff with fsmonitor running is significantly better with this patch series (80% faster on my workload)! GIT_PERF_LARGE_REPO=~/src/server ./run v2.29.0-rc1 . -- p7519-fsmonitor.sh Test v2.29.0-rc1 this tree ----------------------------------------------------------------------------------------------------------------- 7519.2: status (fsmonitor=.git/hooks/fsmonitor-watchman) 1.46(0.82+0.64) 1.47(0.83+0.62) +0.7% 7519.3: status -uno (fsmonitor=.git/hooks/fsmonitor-watchman) 0.16(0.12+0.04) 0.17(0.12+0.05) +6.3% 7519.4: status -uall (fsmonitor=.git/hooks/fsmonitor-watchman) 1.36(0.73+0.62) 1.37(0.76+0.60) +0.7% 7519.5: diff (fsmonitor=.git/hooks/fsmonitor-watchman) 0.85(0.22+0.63) 0.14(0.10+0.05) -83.5% 7519.6: diff -- 0_files (fsmonitor=.git/hooks/fsmonitor-watchman) 0.12(0.08+0.05) 0.13(0.11+0.02) +8.3% 7519.7: diff -- 10_files (fsmonitor=.git/hooks/fsmonitor-watchman) 0.12(0.08+0.04) 0.13(0.09+0.04) +8.3% 7519.8: diff -- 100_files (fsmonitor=.git/hooks/fsmonitor-watchman) 0.12(0.07+0.05) 0.13(0.07+0.06) +8.3% 7519.9: diff -- 1000_files (fsmonitor=.git/hooks/fsmonitor-watchman) 0.12(0.09+0.04) 0.13(0.08+0.05) +8.3% 7519.10: diff -- 10000_files (fsmonitor=.git/hooks/fsmonitor-watchman) 0.14(0.09+0.05) 0.13(0.10+0.03) -7.1% 7519.12: status (fsmonitor=) 1.67(0.93+1.49) 1.67(0.99+1.42) +0.0% 7519.13: status -uno (fsmonitor=) 0.37(0.30+0.82) 0.37(0.33+0.79) +0.0% 7519.14: status -uall (fsmonitor=) 1.58(0.97+1.35) 1.57(0.86+1.45) -0.6% 7519.15: diff (fsmonitor=) 0.34(0.28+0.83) 0.34(0.27+0.83) +0.0% 7519.16: diff -- 0_files (fsmonitor=) 0.09(0.06+0.04) 0.09(0.08+0.02) +0.0% 7519.17: diff -- 10_files (fsmonitor=) 0.09(0.07+0.03) 0.09(0.06+0.05) +0.0% 7519.18: diff -- 100_files (fsmonitor=) 0.09(0.06+0.04) 0.09(0.06+0.04) +0.0% 7519.19: diff -- 1000_files (fsmonitor=) 0.09(0.06+0.04) 0.09(0.05+0.05) +0.0% 7519.20: diff -- 10000_files (fsmonitor=) 0.10(0.08+0.04) 0.10(0.06+0.05) +0.0% I also added a benchmark for a tiny git diff workload w/ a pathspec. I see an approximately .02 second overhead added w/ and w/o fsmonitor From looking at these results, I suspected that refresh_fsmonitor is already happening during git diff - independent of this patch series' optimization. Confirmed that suspicion by breaking on refresh_fsmonitor. (gdb) bt [simplified] 0 refresh_fsmonitor at fsmonitor.c:176 1 ie_match_stat at read-cache.c:375 2 match_stat_with_submodule at diff-lib.c:237 4 builtin_diff_files at builtin/diff.c:260 5 cmd_diff at builtin/diff.c:541 6 run_builtin at git.c:450 7 handle_builtin at git.c:700 8 run_argv at git.c:767 9 cmd_main at git.c:898 10 main at common-main.c:52 Signed-off-by: Nipunn Koorapati --- t/perf/p7519-fsmonitor.sh | 71 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/t/perf/p7519-fsmonitor.sh b/t/perf/p7519-fsmonitor.sh index 9313d4a51d..ef4c3c8c5c 100755 --- a/t/perf/p7519-fsmonitor.sh +++ b/t/perf/p7519-fsmonitor.sh @@ -115,6 +115,13 @@ test_expect_success "setup for fsmonitor" ' git config core.fsmonitor "$INTEGRATION_SCRIPT" && git update-index --fsmonitor && + mkdir 1_file 10_files 100_files 1000_files 10000_files && + for i in $(test_seq 1 10); do touch 10_files/$i; done && + for i in $(test_seq 1 100); do touch 100_files/$i; done && + for i in $(test_seq 1 1000); do touch 1000_files/$i; done && + for i in $(test_seq 1 10000); do touch 10000_files/$i; done && + git add 1_file 10_files 100_files 1000_files 10000_files && + git commit -m "Add files" && git status # Warm caches ' @@ -142,6 +149,38 @@ test_perf "status -uall (fsmonitor=$INTEGRATION_SCRIPT)" ' git status -uall ' +if test -n "$GIT_PERF_7519_DROP_CACHE"; then + test-tool drop-caches +fi + +test_perf "diff (fsmonitor=$INTEGRATION_SCRIPT)" ' + git diff +' + +if test -n "$GIT_PERF_7519_DROP_CACHE"; then + test-tool drop-caches +fi + +test_perf "diff -- 0_files (fsmonitor=$INTEGRATION_SCRIPT)" ' + git diff -- 1_file +' + +test_perf "diff -- 10_files (fsmonitor=$INTEGRATION_SCRIPT)" ' + git diff -- 10_files +' + +test_perf "diff -- 100_files (fsmonitor=$INTEGRATION_SCRIPT)" ' + git diff -- 100_files +' + +test_perf "diff -- 1000_files (fsmonitor=$INTEGRATION_SCRIPT)" ' + git diff -- 1000_files +' + +test_perf "diff -- 10000_files (fsmonitor=$INTEGRATION_SCRIPT)" ' + git diff -- 10000_files +' + test_expect_success "setup without fsmonitor" ' unset INTEGRATION_SCRIPT && git config --unset core.fsmonitor && @@ -172,6 +211,38 @@ test_perf "status -uall (fsmonitor=$INTEGRATION_SCRIPT)" ' git status -uall ' +if test -n "$GIT_PERF_7519_DROP_CACHE"; then + test-tool drop-caches +fi + +test_perf "diff (fsmonitor=$INTEGRATION_SCRIPT)" ' + git diff +' + +if test -n "$GIT_PERF_7519_DROP_CACHE"; then + test-tool drop-caches +fi + +test_perf "diff -- 0_files (fsmonitor=$INTEGRATION_SCRIPT)" ' + git diff -- 1_file +' + +test_perf "diff -- 10_files (fsmonitor=$INTEGRATION_SCRIPT)" ' + git diff -- 10_files +' + +test_perf "diff -- 100_files (fsmonitor=$INTEGRATION_SCRIPT)" ' + git diff -- 100_files +' + +test_perf "diff -- 1000_files (fsmonitor=$INTEGRATION_SCRIPT)" ' + git diff -- 1000_files +' + +test_perf "diff -- 10000_files (fsmonitor=$INTEGRATION_SCRIPT)" ' + git diff -- 10000_files +' + if test_have_prereq WATCHMAN then watchman watch-del "$GIT_WORK_TREE" >/dev/null 2>&1 && From patchwork Tue Oct 20 13:41:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nipunn Koorapati X-Patchwork-Id: 11846983 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3671C4363A for ; Tue, 20 Oct 2020 13:41:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 858DF21741 for ; Tue, 20 Oct 2020 13:41:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pfMEIB8I" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407572AbgJTNlV (ORCPT ); Tue, 20 Oct 2020 09:41:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407561AbgJTNlN (ORCPT ); Tue, 20 Oct 2020 09:41:13 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86BD7C0613D1 for ; Tue, 20 Oct 2020 06:41:12 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id j7so2179988wrt.9 for ; Tue, 20 Oct 2020 06:41:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=BZCNOpOS7y+zBmTEmsVLBXdb2nimnuuH0JJV82Rd7II=; b=pfMEIB8ICn+dBpMrZEWa4r0L217v5+4w11PWXpzyzbS1ScAS7RIjkfJiQewLPRpGV2 +2prq/8lee7gvAVEk2qV/LpJod3KjYbmnTyf550/78AmddarNOgeuC4HvTQGbtxCUuZm ePJ2c+aQOj+f74UMpf3qwkaW6tPK4XXaP0BtGz5wsMKOrto6Oa6BMcC8s/jU8HSGVgBp FtX9dsjg+dE0+SOtoyBzaf8UY4zGgI+533MLcYDVUdZhy3f8sLX2q1jiJfrpyZUpaPmo 3Hfi/54O0V6fDdYrc8bcf2tr5UUQGYskzsWqNJq0yQrBxn6ptqQXpkunaAyRXsbDY5JY Okcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=BZCNOpOS7y+zBmTEmsVLBXdb2nimnuuH0JJV82Rd7II=; b=YpMSmqKo2X9GkOd2OpVtAnrhOPUO/k0C1UfIhb5UskZ0leaRe8X6r2hghj+btDeg85 y64yDA/PITYIMJ2FJ9UZW5F68uIxVwzOH7/cczbT3D+SBmwsphRdsz3rtXcIP0qQYKV5 mol7gmnhpWglHRjkIen2NF6H6M9lZWNQ3YKhjylw9it0pwJGm8RCnXLMeoQLCa3a4nym LC50bli7sbMxxMP9F6TSMsEJA94d5K5BMsR8drUFkHfyIFUWynhYXJ4JWYEdXZDDXLXH LSTrldrxO9UiZsPJCSQ2sF1UV24x2rXdFmrABytUQb1/P1UUAftWxMv7EBW/MqM9NEzj fKQQ== X-Gm-Message-State: AOAM532ulDNc4zahQzvGxjZkEAfIJOIgpXyvDCOmdEJaFhtnqMJ2tlSs cKyepr8MZCy0HVlSwAFAtkrHH53wBrk= X-Google-Smtp-Source: ABdhPJw/R2Fv7bZu1MR9Cn+jF4Hg0sUOjjSbxWcwytIQd5LUyhXDfPoem0k9IWwWWK4Hd1ay0JhdKQ== X-Received: by 2002:adf:92a1:: with SMTP id 30mr3652418wrn.269.1603201271006; Tue, 20 Oct 2020 06:41:11 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n6sm3116175wrj.60.2020.10.20.06.41.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 06:41:10 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Tue, 20 Oct 2020 13:41:02 +0000 Subject: [PATCH v4 5/7] perf lint: add make test-lint to perf tests Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , Utsav Shah , Nipunn Koorapati , Nipunn Koorapati , Taylor Blau , Nipunn Koorapati , Nipunn Koorapati Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Nipunn Koorapati From: Nipunn Koorapati Perf tests have not been linted for some time. They've grown some seq instead of test_seq. This runs the existing lints on the perf tests as well. Signed-off-by: Nipunn Koorapati --- t/Makefile | 7 ++++--- t/perf/Makefile | 5 ++++- t/perf/p3400-rebase.sh | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/t/Makefile b/t/Makefile index c83fd18861..882d26eee3 100644 --- a/t/Makefile +++ b/t/Makefile @@ -34,6 +34,7 @@ CHAINLINTTMP_SQ = $(subst ','\'',$(CHAINLINTTMP)) T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)) TGITWEB = $(sort $(wildcard t95[0-9][0-9]-*.sh)) THELPERS = $(sort $(filter-out $(T),$(wildcard *.sh))) +TPERF = $(sort $(wildcard perf/p[0-9][0-9][0-9][0-9]-*.sh)) CHAINLINTTESTS = $(sort $(patsubst chainlint/%.test,%,$(wildcard chainlint/*.test))) CHAINLINT = sed -f chainlint.sed @@ -81,17 +82,17 @@ test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax \ test-lint-filenames test-lint-duplicates: - @dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \ + @dups=`echo $(T) $(TPERF) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \ test -z "$$dups" || { \ echo >&2 "duplicate test numbers:" $$dups; exit 1; } test-lint-executable: - @bad=`for i in $(T); do test -x "$$i" || echo $$i; done` && \ + @bad=`for i in $(T) $(TPERF); do test -x "$$i" || echo $$i; done` && \ test -z "$$bad" || { \ echo >&2 "non-executable tests:" $$bad; exit 1; } test-lint-shell-syntax: - @'$(PERL_PATH_SQ)' check-non-portable-shell.pl $(T) $(THELPERS) + @'$(PERL_PATH_SQ)' check-non-portable-shell.pl $(T) $(THELPERS) $(TPERF) test-lint-filenames: @# We do *not* pass a glob to ls-files but use grep instead, to catch diff --git a/t/perf/Makefile b/t/perf/Makefile index 8c47155a7c..fcb0e8865e 100644 --- a/t/perf/Makefile +++ b/t/perf/Makefile @@ -1,7 +1,7 @@ -include ../../config.mak export GIT_TEST_OPTIONS -all: perf +all: test-lint perf perf: pre-clean ./run @@ -12,4 +12,7 @@ pre-clean: clean: rm -rf build "trash directory".* test-results +test-lint: + $(MAKE) -C .. test-lint + .PHONY: all perf pre-clean clean diff --git a/t/perf/p3400-rebase.sh b/t/perf/p3400-rebase.sh index d202aaed06..7a0bb29448 100755 --- a/t/perf/p3400-rebase.sh +++ b/t/perf/p3400-rebase.sh @@ -9,16 +9,16 @@ test_expect_success 'setup rebasing on top of a lot of changes' ' git checkout -f -B base && git checkout -B to-rebase && git checkout -B upstream && - for i in $(seq 100) + for i in $(test_seq 100) do # simulate huge diffs echo change$i >unrelated-file$i && - seq 1000 >>unrelated-file$i && + test_seq 1000 >>unrelated-file$i && git add unrelated-file$i && test_tick && git commit -m commit$i unrelated-file$i && echo change$i >unrelated-file$i && - seq 1000 | tac >>unrelated-file$i && + test_seq 1000 | tac >>unrelated-file$i && git add unrelated-file$i && test_tick && git commit -m commit$i-reverse unrelated-file$i || From patchwork Mon Oct 19 22:47:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nipunn Koorapati X-Patchwork-Id: 11845417 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1ACFC433E7 for ; Mon, 19 Oct 2020 22:47:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7613A2240C for ; Mon, 19 Oct 2020 22:47:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="obJOwI9t" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388652AbgJSWru (ORCPT ); Mon, 19 Oct 2020 18:47:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388637AbgJSWrq (ORCPT ); Mon, 19 Oct 2020 18:47:46 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1033C0613D1 for ; Mon, 19 Oct 2020 15:47:44 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id a72so32666wme.5 for ; Mon, 19 Oct 2020 15:47:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=kRyxFYsdUp56FTApiMNfeHAgQPCyidPizX4u7iT/YYU=; b=obJOwI9to9mqU10H2NdwYnnXrJ18bH8lY6TvG7LATfpRwzbvsgmcjrUw9x86jYGBZK OE9p75dX3KAiSVykqJALhQYh4NtXPJWz7iDCbXRYDBhcLIukY19TV9GBJGoYppxDEnBy a2KPtcccLtt9Ws/aBE3ajM6l8EgdHgi+NudXZzdkLkonwI7ZWqqlP5/mj0YAUh9lQf7P KaUXh0DE8fom6LMumtx4K/agSxFrhsnXi8Eg3HeXE6IRBwxlK0oWW5jtYelzXW8ZCGqD gMFROt3g31BJ9PGB7fkPJ5pot5qS7bFYTUNwnEO7aVJhiEVG+vdyEtT2cFicia9/NtWh v7NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=kRyxFYsdUp56FTApiMNfeHAgQPCyidPizX4u7iT/YYU=; b=N9jrV+qM6wzyFrcb4GFdLotEjunC4wruQA7rMr+RtxG+nKlB/9+Kromow9/RWAI9k/ NQ4S/mE/eXbcgnB60zl2gsoAvQeLGz/g0s5VuWxofOCs60V+RCZDoU6aNMnjWXVp1zcB 5AHD2V3h3gDiFo1W19b22iEnTMEy/9mUno+S13eRKHJo9vY2S6Q1jhlhr0tHJQv6R4Oq f/OFmUalsEAx+F7Z4UiFlJk67hr1fRdWIvxnybqXWvIrP0+iwdbD7LgHlzl4/2jx/Ng7 cKNahAk2ez0QXZ7IQ5CA8iSgm8x/R8Vn9AjNn8g2BWwR/zflLE6PoB+2mK8+Cm97TKAr jTvA== X-Gm-Message-State: AOAM531A6uW3WSx/IvPsCo6xusgcnEp6DHnaB9ImVI10QsJoT8jLyUHE iuPeAEr5s2BH8DsCTh9YzTYMfGInmE8= X-Google-Smtp-Source: ABdhPJy9zsECglZC5pDw4eDySDxIe5zZ2+Ic7/pQqR87yuDaS06aKWaU1Unpgxpfi9jtKdEhwR7IHA== X-Received: by 2002:a1c:6457:: with SMTP id y84mr103066wmb.36.1603147663335; Mon, 19 Oct 2020 15:47:43 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id x64sm45820wmg.33.2020.10.19.15.47.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Oct 2020 15:47:42 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Mon, 19 Oct 2020 22:47:36 +0000 Subject: [PATCH v3 6/7] p7519-fsmonitor: refactor to avoid code duplication Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , Utsav Shah , Nipunn Koorapati , Nipunn Koorapati , Taylor Blau , Nipunn Koorapati , Nipunn Koorapati Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Nipunn Koorapati From: Nipunn Koorapati Much of the benchmark code is redundant. This is easier to understand and edit. Signed-off-by: Nipunn Koorapati --- t/perf/p7519-fsmonitor.sh | 136 +++++++++++--------------------------- 1 file changed, 37 insertions(+), 99 deletions(-) diff --git a/t/perf/p7519-fsmonitor.sh b/t/perf/p7519-fsmonitor.sh index ef4c3c8c5c..75a0cef01d 100755 --- a/t/perf/p7519-fsmonitor.sh +++ b/t/perf/p7519-fsmonitor.sh @@ -125,61 +125,53 @@ test_expect_success "setup for fsmonitor" ' git status # Warm caches ' -if test -n "$GIT_PERF_7519_DROP_CACHE"; then - test-tool drop-caches -fi +test_perf_w_drop_caches () { + if test -n "$GIT_PERF_7519_DROP_CACHE"; then + test-tool drop-caches + fi -test_perf "status (fsmonitor=$INTEGRATION_SCRIPT)" ' - git status -' + test_perf "$@" +} -if test -n "$GIT_PERF_7519_DROP_CACHE"; then - test-tool drop-caches -fi +test_fsmonitor_suite() { + test_perf_w_drop_caches "status (fsmonitor=$INTEGRATION_SCRIPT)" ' + git status + ' -test_perf "status -uno (fsmonitor=$INTEGRATION_SCRIPT)" ' - git status -uno -' + test_perf_w_drop_caches "status -uno (fsmonitor=$INTEGRATION_SCRIPT)" ' + git status -uno + ' -if test -n "$GIT_PERF_7519_DROP_CACHE"; then - test-tool drop-caches -fi + test_perf_w_drop_caches "status -uall (fsmonitor=$INTEGRATION_SCRIPT)" ' + git status -uall + ' -test_perf "status -uall (fsmonitor=$INTEGRATION_SCRIPT)" ' - git status -uall -' - -if test -n "$GIT_PERF_7519_DROP_CACHE"; then - test-tool drop-caches -fi - -test_perf "diff (fsmonitor=$INTEGRATION_SCRIPT)" ' - git diff -' + test_perf_w_drop_caches "diff (fsmonitor=$INTEGRATION_SCRIPT)" ' + git diff + ' -if test -n "$GIT_PERF_7519_DROP_CACHE"; then - test-tool drop-caches -fi + test_perf_w_drop_caches "diff -- 0_files (fsmonitor=$INTEGRATION_SCRIPT)" ' + git diff -- 1_file + ' -test_perf "diff -- 0_files (fsmonitor=$INTEGRATION_SCRIPT)" ' - git diff -- 1_file -' + test_perf_w_drop_caches "diff -- 10_files (fsmonitor=$INTEGRATION_SCRIPT)" ' + git diff -- 10_files + ' -test_perf "diff -- 10_files (fsmonitor=$INTEGRATION_SCRIPT)" ' - git diff -- 10_files -' + test_perf_w_drop_caches "diff -- 100_files (fsmonitor=$INTEGRATION_SCRIPT)" ' + git diff -- 100_files + ' -test_perf "diff -- 100_files (fsmonitor=$INTEGRATION_SCRIPT)" ' - git diff -- 100_files -' + test_perf_w_drop_caches "diff -- 1000_files (fsmonitor=$INTEGRATION_SCRIPT)" ' + git diff -- 1000_files + ' -test_perf "diff -- 1000_files (fsmonitor=$INTEGRATION_SCRIPT)" ' - git diff -- 1000_files -' + test_perf_w_drop_caches "diff -- 10000_files (fsmonitor=$INTEGRATION_SCRIPT)" ' + git diff -- 10000_files + ' +} -test_perf "diff -- 10000_files (fsmonitor=$INTEGRATION_SCRIPT)" ' - git diff -- 10000_files -' +test_fsmonitor_suite test_expect_success "setup without fsmonitor" ' unset INTEGRATION_SCRIPT && @@ -187,61 +179,7 @@ test_expect_success "setup without fsmonitor" ' git update-index --no-fsmonitor ' -if test -n "$GIT_PERF_7519_DROP_CACHE"; then - test-tool drop-caches -fi - -test_perf "status (fsmonitor=$INTEGRATION_SCRIPT)" ' - git status -' - -if test -n "$GIT_PERF_7519_DROP_CACHE"; then - test-tool drop-caches -fi - -test_perf "status -uno (fsmonitor=$INTEGRATION_SCRIPT)" ' - git status -uno -' - -if test -n "$GIT_PERF_7519_DROP_CACHE"; then - test-tool drop-caches -fi - -test_perf "status -uall (fsmonitor=$INTEGRATION_SCRIPT)" ' - git status -uall -' - -if test -n "$GIT_PERF_7519_DROP_CACHE"; then - test-tool drop-caches -fi - -test_perf "diff (fsmonitor=$INTEGRATION_SCRIPT)" ' - git diff -' - -if test -n "$GIT_PERF_7519_DROP_CACHE"; then - test-tool drop-caches -fi - -test_perf "diff -- 0_files (fsmonitor=$INTEGRATION_SCRIPT)" ' - git diff -- 1_file -' - -test_perf "diff -- 10_files (fsmonitor=$INTEGRATION_SCRIPT)" ' - git diff -- 10_files -' - -test_perf "diff -- 100_files (fsmonitor=$INTEGRATION_SCRIPT)" ' - git diff -- 100_files -' - -test_perf "diff -- 1000_files (fsmonitor=$INTEGRATION_SCRIPT)" ' - git diff -- 1000_files -' - -test_perf "diff -- 10000_files (fsmonitor=$INTEGRATION_SCRIPT)" ' - git diff -- 10000_files -' +test_fsmonitor_suite if test_have_prereq WATCHMAN then