From patchwork Wed Mar 17 21:22:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nipunn Koorapati X-Patchwork-Id: 12146987 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=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 41215C433DB for ; Wed, 17 Mar 2021 21:23:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EAB1764F38 for ; Wed, 17 Mar 2021 21:23:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232220AbhCQVWt (ORCPT ); Wed, 17 Mar 2021 17:22:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232089AbhCQVW0 (ORCPT ); Wed, 17 Mar 2021 17:22:26 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58AF5C06174A for ; Wed, 17 Mar 2021 14:22:26 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id d8-20020a1c1d080000b029010f15546281so1884150wmd.4 for ; Wed, 17 Mar 2021 14:22:26 -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=QXXZ6PRSQKxTNeQUBO+QCyPzTHcNrIuHhP1pl77Aebg=; b=K3PQ8nzG/Yc4FXsEZQxQUH3Xu3FBFXTxHT7ZATlYbAeKWSzr0LEZE4AOejQ2sN4SYP N0lGabIE2rcDxwLsAFcmo3oYCPYM1bkm1XlY+Xk8MG9nz4/fPX8h4jJv3SZ0+CeigFIK cvFfh0Ih48HXMe8K+xirHmeiYvqGuR9yePN1loOddlnIWxVkajPRF4TrbVVHVOAD2kdY xIrc1+8dKnhbs4v0Ajd8YBNTbSwdnfBBplRgpmgQo64PkxMbarRXS4H2d14ukTUYjyI+ pMJpGS3+v45tmJBnyp7afq7Gm2OZGU83lWayRlpfdr2kY+4YKGSfZhPMOiG2AGKly5+b PDBg== 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=QXXZ6PRSQKxTNeQUBO+QCyPzTHcNrIuHhP1pl77Aebg=; b=VT4R3QhZOBUe409HTPqNFAW1CiHgpj66bq9e9vOD7kR5lLIy3paNe3++Qx1bV7RSgO cSV3pko9PPR0eLRB3BINnSDY/z0TSBB8EgVt/j6Dcz+XVxXw5A76j62Qv7WYOtVGPhaA QTRHOT9vY26oCdaka43KKfXC0sETvcC2uYoTdnP3PqA9DnbDJdeWsRhzts5+QA094rfb AD112Fp37zU7bRX1/BsxUA57hhxG3FX/vwL/YK2mirbld7CLu0ncJ01/2LK40PhKh1m+ oEMoL3AnV+D6sB83hk0nawcv/OvSR7EGbveNuUKc4tqVJsSP9g0D7xPiTLzotlR+rlEj pFnw== X-Gm-Message-State: AOAM532ij/WLJRVEHZ/W1LkFXpF2e7/EoDoApFHyFNGwsdMthCqVNiuV Xz2s+QQ1rheC6Foc9/B/gBygvJGsk+I= X-Google-Smtp-Source: ABdhPJxwWFm7LdsJLoO70i/IncbwnJBVMrXLWuuWUy6Uu3aYJEGY3nKhhwKC7x5FBvC/KK3C7xL9mA== X-Received: by 2002:a1c:e389:: with SMTP id a131mr670353wmh.78.1616016145075; Wed, 17 Mar 2021 14:22:25 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id b15sm109656wmd.41.2021.03.17.14.22.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 14:22:24 -0700 (PDT) Message-Id: <75a3c46c405549d1f5127097729c556a7e297587.1616016143.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 17 Mar 2021 21:22:21 +0000 Subject: [PATCH v2 1/3] fsmonitor: skip lstat deletion check during git diff-index Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Eric Sunshine , Nipunn Koorapati , Nipunn Koorapati Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Nipunn Koorapati From: Nipunn Koorapati Teach git to honor fsmonitor rather than issuing an lstat when checking for dirty local deletes. Eliminates O(files) lstats during `git diff HEAD` Signed-off-by: Nipunn Koorapati --- diff-lib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/diff-lib.c b/diff-lib.c index b73cc1859a49..3fb538ad18e9 100644 --- a/diff-lib.c +++ b/diff-lib.c @@ -30,7 +30,7 @@ */ static int check_removed(const struct cache_entry *ce, struct stat *st) { - if (lstat(ce->name, st) < 0) { + if (!(ce->ce_flags & CE_FSMONITOR_VALID) && lstat(ce->name, st) < 0) { if (!is_missing_file_error(errno)) return -1; return 1; @@ -574,6 +574,7 @@ int run_diff_index(struct rev_info *revs, unsigned int option) struct object_id oid; const char *name; char merge_base_hex[GIT_MAX_HEXSZ + 1]; + struct index_state *istate = revs->diffopt.repo->index; if (revs->pending.nr != 1) BUG("run_diff_index must be passed exactly one tree"); @@ -581,6 +582,8 @@ int run_diff_index(struct rev_info *revs, unsigned int option) trace_performance_enter(); ent = revs->pending.objects; + refresh_fsmonitor(istate); + if (merge_base) { diff_get_merge_base(revs, &oid); name = oid_to_hex_r(merge_base_hex, &oid); From patchwork Wed Mar 17 21:22:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nipunn Koorapati X-Patchwork-Id: 12146993 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=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 C4806C4332B for ; Wed, 17 Mar 2021 21:23:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8EE0F64F30 for ; Wed, 17 Mar 2021 21:23:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232088AbhCQVWu (ORCPT ); Wed, 17 Mar 2021 17:22:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232126AbhCQVW1 (ORCPT ); Wed, 17 Mar 2021 17:22:27 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 040A8C06174A for ; Wed, 17 Mar 2021 14:22:27 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id e9so3292572wrw.10 for ; Wed, 17 Mar 2021 14:22:26 -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=6KNXDGoitQ2WAL8RoqTvOtQjxMDXBXamGfnXIhIf474=; b=ofUY9RZ0jiSCQd8E9l3LUmGgA7IdejYv5/OJ5yQrJDEUBl5ELXRGiK/1SigwbARjpp cRuJL+ezgqVHnf+1s4OaVghBe50N8WTI/wWoEwTrHR1y6yd4h/bNCCfDd1OC78geTb0f T6Dma7P9emLOPccX1/yNFo4zfqq7rS0wa7wQZYh/bfV6sGsGSl8AlBEBVHAbgxzc5/os tTjv/7FTIkkqFMLlLFZ1dppAo8cg2Xg4Y1+qFrflZol9pNvHeperH0+f5uRN+sPaV/av lMkct9On/Aaf7h5mW0ndABWrNySL6TpsuBdnc0nEHfnqSYjUKM6LVmu7WdS6KwgvTo+d y19w== 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=6KNXDGoitQ2WAL8RoqTvOtQjxMDXBXamGfnXIhIf474=; b=dXMAw/724H8rvTCLc4dkypLEWynsPELw5mBP+7P45xZlWfVfDvP4agfZV/7N2+zZeP hxgOKtfaSGDn6rl9beAoYPA2FI3uE7Bx9K0rP6DisIZRBxOOAx9y/n6PMZNAsAaFddjx r9scNz1uGOSyS5JQoXum7kTLCq42UKLUlNXu4ZBr+ZTsxtJRLuUbzaLDjvw+s6qzBTRu BnWBjgGmRhZElfUcSQuHLyX9L+GF6GheCLITFSrWNyPdNd3o32Yr0JOwFOqg9JWp5JFm DXu6xaWsvCp9Dnyw6+Qz+EQJJxOn6iSIDUY1ZWh3aTDNmW2f9dGhlOVpadvfbAArsvcP WZ1A== X-Gm-Message-State: AOAM531xpV4CjGGB6EiDlklGSBeuVmrVW4Z8xVdgDfybEnMZn4I3R4rm jSnniD0JhrJljb0KDKfAHGFnUAlGoaE= X-Google-Smtp-Source: ABdhPJz9C5PFMEfz+16ZXK3wVh6O/K6tCW0SEBcG8EN6TB0hvVl9Dvhhy2Su+DtE0UDqVJ0dwyG5TQ== X-Received: by 2002:a5d:6587:: with SMTP id q7mr6238007wru.282.1616016145797; Wed, 17 Mar 2021 14:22:25 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id u2sm222656wrp.12.2021.03.17.14.22.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 14:22:25 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Wed, 17 Mar 2021 21:22:22 +0000 Subject: [PATCH v2 2/3] fsmonitor: add assertion that fsmonitor is valid to check_removed Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Eric Sunshine , Nipunn Koorapati , Nipunn Koorapati Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Nipunn Koorapati From: Nipunn Koorapati Validate that fsmonitor is valid to futureproof against bugs where check_removed might be called from places that haven't refreshed. Signed-off-by: Nipunn Koorapati --- diff-lib.c | 18 +++++++++++------- fsmonitor.h | 11 +++++++++++ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/diff-lib.c b/diff-lib.c index 3fb538ad18e9..e5a58c9259cf 100644 --- a/diff-lib.c +++ b/diff-lib.c @@ -28,8 +28,9 @@ * exists for ce that is a submodule -- it is a submodule that is not * checked out). Return negative for an error. */ -static int check_removed(const struct cache_entry *ce, struct stat *st) +static int check_removed(const struct index_state *istate, const struct cache_entry *ce, struct stat *st) { + assert(is_fsmonitor_refreshed(istate)); if (!(ce->ce_flags & CE_FSMONITOR_VALID) && lstat(ce->name, st) < 0) { if (!is_missing_file_error(errno)) return -1; @@ -136,7 +137,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option) memset(&(dpath->parent[0]), 0, sizeof(struct combine_diff_parent)*5); - changed = check_removed(ce, &st); + changed = check_removed(istate, ce, &st); if (!changed) wt_mode = ce_mode_from_stat(ce, st.st_mode); else { @@ -216,7 +217,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option) } else { struct stat st; - changed = check_removed(ce, &st); + changed = check_removed(istate, ce, &st); if (changed) { if (changed < 0) { perror(ce->name); @@ -278,7 +279,8 @@ static void diff_index_show_file(struct rev_info *revs, oid, oid_valid, ce->name, dirty_submodule); } -static int get_stat_data(const struct cache_entry *ce, +static int get_stat_data(const struct index_state *istate, + const struct cache_entry *ce, const struct object_id **oidp, unsigned int *modep, int cached, int match_missing, @@ -290,7 +292,7 @@ static int get_stat_data(const struct cache_entry *ce, if (!cached && !ce_uptodate(ce)) { int changed; struct stat st; - changed = check_removed(ce, &st); + changed = check_removed(istate, ce, &st); if (changed < 0) return -1; else if (changed) { @@ -321,12 +323,13 @@ static void show_new_file(struct rev_info *revs, const struct object_id *oid; unsigned int mode; unsigned dirty_submodule = 0; + struct index_state *istate = revs->diffopt.repo->index; /* * New file in the index: it might actually be different in * the working tree. */ - if (get_stat_data(new_file, &oid, &mode, cached, match_missing, + if (get_stat_data(istate, new_file, &oid, &mode, cached, match_missing, &dirty_submodule, &revs->diffopt) < 0) return; @@ -342,8 +345,9 @@ static int show_modified(struct rev_info *revs, unsigned int mode, oldmode; const struct object_id *oid; unsigned dirty_submodule = 0; + struct index_state *istate = revs->diffopt.repo->index; - if (get_stat_data(new_entry, &oid, &mode, cached, match_missing, + if (get_stat_data(istate, new_entry, &oid, &mode, cached, match_missing, &dirty_submodule, &revs->diffopt) < 0) { if (report_missing) diff_index_show_file(revs, "-", old_entry, diff --git a/fsmonitor.h b/fsmonitor.h index 7f1794b90b00..f20d72631d76 100644 --- a/fsmonitor.h +++ b/fsmonitor.h @@ -49,6 +49,17 @@ void refresh_fsmonitor(struct index_state *istate); */ int fsmonitor_is_trivial_response(const struct strbuf *query_result); +/* + * Check if refresh_fsmonitor has been called at least once. + * refresh_fsmonitor is idempotent. Returns true if fsmonitor is + * not enabled (since the state will be "fresh" w/ CE_FSMONITOR_VALID unset) + * This version is useful for assertions + */ +static inline int is_fsmonitor_refreshed(const struct index_state *istate) +{ + return !core_fsmonitor || istate->fsmonitor_has_run_once; +} + /* * Set the given cache entries CE_FSMONITOR_VALID bit. This should be * called any time the cache entry has been updated to reflect the From patchwork Wed Mar 17 21:22:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nipunn Koorapati X-Patchwork-Id: 12146991 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=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 BC6A2C43381 for ; Wed, 17 Mar 2021 21:23:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B53B64F2A for ; Wed, 17 Mar 2021 21:23:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232126AbhCQVWv (ORCPT ); Wed, 17 Mar 2021 17:22:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232130AbhCQVW2 (ORCPT ); Wed, 17 Mar 2021 17:22:28 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F46CC06174A for ; Wed, 17 Mar 2021 14:22:28 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id t9so3285708wrn.11 for ; Wed, 17 Mar 2021 14:22:28 -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=JMp1bmmwlsn2ikqNcbnAac9oA+bMf7D+78DgGfLuKVo=; b=RiwI5pbyXGXCfNX436GF27wGIlro1J6pU4CAexC3XCnM3JBb1X7orcueOZ38R2OxwJ gD375Sk0F/mn0kKWaKyxur/+LPmozI6MdOpPqXls7MC1sChVpaL8Zfb+OCQaEWyJCXro 0tpfufIt34LJ3STcl+sJPOcYrM6Jynx4s+AaSOCIk7vTMjNPNLa5Hp8xkr2x7klQ7Dq6 EMtm6VNRvoQFU5R1l4+VegxDcbugTtr49kxsiTv6IveH/kaGDnIuef327TxD4VMhGzoQ kITrHJxlXesz2pGPbod4jnFAyGQU7ldXR4mgb9JdHSiLj5Ut7u1tP+IP6JwIl2lBeZIZ qAfQ== 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=JMp1bmmwlsn2ikqNcbnAac9oA+bMf7D+78DgGfLuKVo=; b=T1mWy6s8JdbwelhftkJihQgRwYd/fTyHZ6PxNRjvSobuHcVpL4ohJpRW9x1yVM4UOl qibsdJT9ZoUGr8xGvr5P2c/tu6u4l47bvM5OAcF6ttvteJ4CDOZqmAE1NdqrQed032+J Rme+1F5vHnANUXwQnpP/Ms4uiQ+nSihh1WhX+fpcuQ1TApM/3pogfRU92YW3hH98WVK1 a5NVT2Ia+kukZpafrAD8/H6Cb8RtQS6fO4+8rLUbtNu0wm6eMha+xkflrwG4Wpk6eazz 7JcaxD12FVyhomQVXaY6FG9wI0w8/L4EcoAkAMviMCaq7LKMuUEHMbj2rJvff8Om2PRL FglQ== X-Gm-Message-State: AOAM5304lSPnTWzbZ2MH76uSGD5vCkeOAQNXf0U9ZUjaXHLElqxq9K9N iwxuBb3m4wNsXqJho3wkOTZpRO/3rqM= X-Google-Smtp-Source: ABdhPJz5SrzVfXLVgaaENN1+YZ9q2f8GyLMiMOqmCSEHAPmVW+MQJ1/IagKMWe/zQTmaVNatRoNbAw== X-Received: by 2002:a5d:560e:: with SMTP id l14mr6280903wrv.10.1616016146324; Wed, 17 Mar 2021 14:22:26 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id m132sm90986wmf.45.2021.03.17.14.22.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 14:22:26 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Wed, 17 Mar 2021 21:22:23 +0000 Subject: [PATCH v2 3/3] fsmonitor: add perf test for git diff HEAD Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Eric Sunshine , Nipunn Koorapati , Nipunn Koorapati Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Nipunn Koorapati From: Nipunn Koorapati Update the xargs call so that if your large repo contains symlinks, test-tool chmtime failure does not end the script. On Linux Test this tree upstream/master --------------------------------------------------------------------------------------------------------- 7519.4: status (fsmonitor=fsmonitor-watchman) 0.52(0.43+0.10) 0.53(0.49+0.05) +1.9% 7519.5: status -uno (fsmonitor=fsmonitor-watchman) 0.21(0.15+0.07) 0.22(0.13+0.09) +4.8% 7519.6: status -uall (fsmonitor=fsmonitor-watchman) 1.65(0.93+0.71) 1.69(1.03+0.65) +2.4% 7519.7: status (dirty) (fsmonitor=fsmonitor-watchman) 11.99(11.34+1.58) 11.95(11.02+1.79) -0.3% 7519.8: diff (fsmonitor=fsmonitor-watchman) 0.25(0.17+0.26) 0.25(0.18+0.26) +0.0% 7519.9: diff HEAD (fsmonitor=fsmonitor-watchman) 0.39(0.25+0.34) 0.89(0.35+0.74) +128.2% 7519.10: diff -- 0_files (fsmonitor=fsmonitor-watchman) 0.16(0.13+0.04) 0.16(0.12+0.05) +0.0% 7519.11: diff -- 10_files (fsmonitor=fsmonitor-watchman) 0.16(0.12+0.05) 0.16(0.12+0.05) +0.0% 7519.12: diff -- 100_files (fsmonitor=fsmonitor-watchman) 0.16(0.12+0.05) 0.16(0.12+0.05) +0.0% 7519.13: diff -- 1000_files (fsmonitor=fsmonitor-watchman) 0.16(0.11+0.06) 0.16(0.12+0.05) +0.0% 7519.14: diff -- 10000_files (fsmonitor=fsmonitor-watchman) 0.18(0.13+0.06) 0.17(0.10+0.08) -5.6% 7519.15: add (fsmonitor=fsmonitor-watchman) 2.25(1.53+0.68) 2.25(1.47+0.74) +0.0% 7519.18: status (fsmonitor=disabled) 0.88(0.73+1.03) 0.89(0.67+1.08) +1.1% 7519.19: status -uno (fsmonitor=disabled) 0.45(0.43+0.89) 0.45(0.34+0.98) +0.0% 7519.20: status -uall (fsmonitor=disabled) 1.88(1.16+1.58) 1.88(1.22+1.51) +0.0% 7519.21: status (dirty) (fsmonitor=disabled) 7.53(7.05+2.11) 7.53(6.98+2.04) +0.0% 7519.22: diff (fsmonitor=disabled) 0.42(0.37+0.92) 0.42(0.38+0.91) +0.0% 7519.23: diff HEAD (fsmonitor=disabled) 0.44(0.41+0.90) 0.44(0.40+0.91) +0.0% 7519.24: diff -- 0_files (fsmonitor=disabled) 0.13(0.09+0.05) 0.13(0.09+0.05) +0.0% 7519.25: diff -- 10_files (fsmonitor=disabled) 0.13(0.10+0.04) 0.13(0.10+0.04) +0.0% 7519.26: diff -- 100_files (fsmonitor=disabled) 0.13(0.09+0.05) 0.13(0.10+0.04) +0.0% 7519.27: diff -- 1000_files (fsmonitor=disabled) 0.13(0.09+0.06) 0.13(0.09+0.05) +0.0% 7519.28: diff -- 10000_files (fsmonitor=disabled) 0.14(0.11+0.05) 0.14(0.10+0.05) +0.0% 7519.29: add (fsmonitor=disabled) 2.43(1.61+1.64) 2.43(1.69+1.57) +0.0% On linux (2.29.2 vs w/ this patch): nipunn@nipunn-dbx:~/src/server3$ strace -f -c git diff 2>&1 | grep lstat 0.04 0.000063 3 20 6 lstat nipunn@nipunn-dbx:~/src/server3$ strace -f -c git diff HEAD 2>&1 | grep lstat 94.98 5.242262 10 523783 13 lstat nipunn@nipunn-dbx:~/src/server3$ strace -f -c ../git/bin-wrappers/git diff 2>&1 | grep lstat 0.38 0.000032 5 7 3 lstat nipunn@nipunn-dbx:~/src/server3$ strace -f -c ../git/bin-wrappers/git diff HEAD 2>&1 | grep lstat 99.44 0.741892 9 81634 10 lstat On mac (2.29.2 vs w/ this patch): nipunn-mbp:server nipunn$ sudo dtruss -L -f -c git diff 2>&1 | grep "^lstat64 " lstat64 8 nipunn-mbp:server nipunn$ sudo dtruss -L -f -c git diff HEAD 2>&1 | grep "^lstat64 " lstat64 120242 nipunn-mbp:server nipunn$ sudo dtruss -L -f -c ../git/bin-wrappers/git diff 2>&1 | grep "^lstat64 " lstat64 4 nipunn-mbp:server nipunn$ sudo dtruss -L -f -c ../git/bin-wrappers/git diff HEAD 2>&1 | grep "^lstat64 " lstat64 4497 There are still a bunch of lstats - on directories, but not every file. Progress! Signed-off-by: Nipunn Koorapati --- t/helper/test-chmtime.c | 4 ++-- t/perf/p7519-fsmonitor.sh | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/t/helper/test-chmtime.c b/t/helper/test-chmtime.c index aa22af48c2a6..524b55ca496c 100644 --- a/t/helper/test-chmtime.c +++ b/t/helper/test-chmtime.c @@ -109,9 +109,9 @@ int cmd__chmtime(int argc, const char **argv) uintmax_t mtime; if (stat(argv[i], &sb) < 0) { - fprintf(stderr, "Failed to stat %s: %s\n", + fprintf(stderr, "Failed to stat %s: %s. Skipping\n", argv[i], strerror(errno)); - return 1; + continue; } #ifdef GIT_WINDOWS_NATIVE diff --git a/t/perf/p7519-fsmonitor.sh b/t/perf/p7519-fsmonitor.sh index b657564aed60..5eb5044a103c 100755 --- a/t/perf/p7519-fsmonitor.sh +++ b/t/perf/p7519-fsmonitor.sh @@ -216,6 +216,10 @@ test_fsmonitor_suite() { git diff ' + test_perf_w_drop_caches "diff HEAD ($DESC)" ' + git diff HEAD + ' + test_perf_w_drop_caches "diff -- 0_files ($DESC)" ' git diff -- 1_file '