From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 32695 invoked from network); 4 Aug 2021 08:55:39 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 4 Aug 2021 08:55:39 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1628067339; b=pSOJxu3AMykmvArgDfoN7S/bSRIAn57UZ0YmK67bCqX8HysalY3n67i4IsWihPcWosVHTuwwtY uUpb4Hw3Vn+kQB+4cBLVGucrzY9iWXuvmo0e5XRf5HDXlI53aTBwLVLtsIgwR1BGjMfuOa72gh J/uzr3FhjEaas1RsOTYQG3CPIUI44FjdjfOm3GjSJVCW2F92/LwrWo2S4KXpNSMhxvvR5vkvn5 ARqa9+xSpq3m38HwahsQNIyfHU74yRP2wO21obNnNuodTJq1J/20d237UprzWLLkT33uI3A50q fa9vPxga7/UWIXzN4eJAsyX+/V2REaGBxSWPZXsKQ3NiWg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (a.mx.sigpipe.cz) smtp.remote-ip=37.221.242.114; dmarc=none header.from=sigpipe.cz; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1628067339; bh=y2mP8C2V02Qgd7mw8RzV0d6MfZ46DFU+hkmXIzl67qE=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:DKIM-Signature; b=UWLxfR55G/3E2nsowHSzUD0PAA2M8COqjXUVmtM01yuilFMjjIvp4TLau51JjHZxJRiywW/rL4 eL8XZWog5Lj6sgeHe0IeAv2OpnEjjEzYnMM4e4WTnOXXqteBNkUGITo5IjTs0yYgA43nxkMw54 uPnp/KuSWSwU2V7yQejQRmOmyUURHdewfzOx/UU6+NfWOUszSmcXeYG4dWMzHEMWN7wKk4EDKj kHR0wtODAYFvOEErlF7YoGaSJMvMC5H0ne54FeZjPwwdwbECUS1yJZsZggytOmrYQmy2H9jhfX ffH3XSudVcQxnR8X27L04LwAgezNaCrVkxlTFko32EMqzg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID; bh=TIDcPQUmEaObzPMkgP2gLm/t4HdnzYtSRHAY6DiTiYk=; b=d0f5l7PtBeqTmHUS/hFjXKlwCf zCTJYI33f1mZ+I69ArYyrCk2iqRPYQJxMlPtcdPmkRRNqWaOMz1R1cVAdAPrJECp7uKa4u8gwPvjh 8rlPpe4zqKFnosF6Wqn27v7FqVPv1SiTGS/V9mVJ3sWPa48LQzdEetf0ZjdJIZypiYo0uJppH/RcJ CQW+7fAt6+xUW8V1np87LTpupFIidA/PaPmjbCHhIsvUOQN/YjXF2YLr5skGkg6HEO04hNqTBlvjx j44rnQ8BzNPGIwaIje2yxFk8EYMDS3eFbStMYEYFAxgQmkIxade/yAozhCBMkDlfqrNTEVScDgOeg U3cX+QKw==; Received: from authenticated user by zero.zsh.org with local id 1mBCgb-0007S1-W8; Wed, 04 Aug 2021 08:55:38 +0000 Authentication-Results: zsh.org; iprev=pass (a.mx.sigpipe.cz) smtp.remote-ip=37.221.242.114; dmarc=none header.from=sigpipe.cz; arc=none Received: from a.mx.sigpipe.cz ([37.221.242.114]:4769) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mBCg5-0007Ab-77; Wed, 04 Aug 2021 08:55:06 +0000 Received: by a.mx.sigpipe.cz (Postfix, from userid 1001) id 10F721555037A8; Wed, 4 Aug 2021 10:55:04 +0200 (CEST) Date: Wed, 4 Aug 2021 10:55:03 +0200 From: Roman Neuhauser To: "Suraj N. Kurapati" Cc: Roman Perepelitsa , Zsh hackers list Subject: Re: [PR] vcs_info-examples: optimize +vi-git-untracked() #76 Message-ID: References: <20210626230903.43ba5516@ratham> <20210628155736.6982862a@ratham> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210628155736.6982862a@ratham> X-Seq: 49240 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: # sunaku@riseup.net / 2021-06-28 15:57:36 -0700: > On Sun, 27 Jun 2021 15:03:17 +0200, Roman Perepelitsa wrote: > > On Sun, Jun 27, 2021 at 8:07 AM Suraj N. Kurapati wrote: > > > Speed up the prompt on large and/or deep working directories [...] > > > > Do you have an estimate of the speedup? Numbers from at least one > > repository on one machine would be useful to see. > > I see a 4x speedup on a large Git-enabled home directory, as follows: > > $ time (git status --porcelain | wc -l) > 212 > 0.01s user 0.02s system 0% cpu 9.021 total > > $ time (git status --porcelain | grep '??' &>/dev/null) > 0.01s user 0.02s system 0% cpu 12.294 total > > $ time (git status --porcelain | grep -q '^?? ' 2>/dev/null) > 0.01s user 0.01s system 0% cpu 3.097 total this might be of interest (example code should be exemplary, no? :) BACKGROUND REFRESH By default, git status will automatically refresh the index, updating the cached stat information from the working tree and writing out the result. Writing out the updated index is an optimization that isn’t strictly necessary (status computes the values for itself, but writing them out is just to save subsequent programs from repeating our computation). When status is run in the background, the lock held during the write may conflict with other simultaneous processes, causing them to fail. Scripts running status in the background should consider using git --no-optional-locks status (see git(1) for details). -- roman