From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 92027035 for ; Sun, 8 Sep 2019 19:06:07 +0000 (UTC) Received: (qmail 12227 invoked by alias); 8 Sep 2019 19:05:58 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24242 Received: (qmail 3457 invoked by uid 1010); 8 Sep 2019 19:05:58 -0000 X-Qmail-Scanner-Diagnostics: from ny007.relay.arandomserver.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25566. spamassassin: 3.4.2. Clear:RC:0(172.96.188.169):SA:0(-2.0/5.0):. Processed in 3.226309 secs); 08 Sep 2019 19:05:58 -0000 X-Envelope-From: nick@goots.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _ny-spf.arandomserver.com designates 172.96.188.169 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=goots.org; s=default; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version :Date:Message-ID:From:Cc:References:To:Subject:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=gJpkX8WJbJ8BEVEHReQeG5Nt5tJ3L8hRa4ZN7+gtvBc=; b=fYCV/snCPMMjn43ktAcO3ncJNY jFUGUs9T3/PsROSmZ+zIwVRHqTu+dM/b7PzonChYNEzeffC5qKhChwof0JbWAOqd6uMK2d3b1Tnue jegD8x3/vSnlnPb82X/jQYnx1Ycy7SulmH2nYIX1PdWEczb/hkV/nMq9NGPIqGVmF6SX3cGPH40ol 65Wxz7M95lilcjGCIw0IjsB8svbzIM1KInP1/YxMnl2ns0wjICoEgHFhD6ov1McAngPbcuyNptauZ fd7zqOW0pcfvkQSNAw8mqvrp0x7ImsFtTIXTQQLu9RFuOfI6grlDv0As6Hyqgy/MwY6WkrGJPT+AU oWuk779Q==; Subject: Re: Is it worthwhile to use oh-my-zsh? To: Roman Perepelitsa , Bart Schaefer References: <87woejhnct.fsf@ft.bewatermyfriend.org> Cc: Frank Terbeck , Peng Yu , zsh-users From: Nick Cross Message-ID: <51c3449f-e35c-2935-551f-705219f9a0d6@goots.org> Date: Sun, 8 Sep 2019 20:05:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-AuthUser: goots@goots.org X-Originating-IP: 172.96.184.4 X-SpamExperts-Domain: ams203.hawkhost.com X-SpamExperts-Username: relay Authentication-Results: arandomserver.com; auth=pass (login) smtp.auth=relay@ams203.hawkhost.com X-SpamExperts-Outgoing-Class: unsure X-SpamExperts-Outgoing-Evidence: Combined (0.36) X-Recommended-Action: accept X-Filter-ID: Mvzo4OR0dZXEDF/gcnlw0aDrId51ygpPivCXTf8hoIupSDasLI4SayDByyq9LIhVUbak9i2oUxmz 3gKUzOdh3kTNWdUk1Ol2OGx3IfrIJKyP9eGNFz9TW9u+Jt8z2T3Kl1t3PxQdgOVB4KO7stALLR/T yZcaOeKSW0eEl/J2o0lPeGOILrA0pySby+mq625TCfN9oH8lVNbwwP1Az0AhNotVNt+zLsOifUp7 W0neSC3MSNHC4Usbz0GWYU4irJlGd9PwWEIwStgUTKJGu0IBAvsGpi/XVz2IMZMQ4fDGp3BMWDlu VfC7Hx6zI6pwGIjdFSrPlqRoin0PHUrRMUN0+xBK8cPbR9e2apZeCGfuqGEsd20hl6uVuv0nRRE+ beobPmgABvsr6mKUMHFxriBdSFCSI0Lczs+P8xj2AYuOH+e83LSTcnwYBLaLk1TUm2JPfzbud2+3 rX8/co/6BbQA0Zb5Pn6ftQZVK9K8EAjn37sUg69eDYNe2itClT3S7bjQfaBQB1H4UO2vYsaJ9bOi XgHs0O3lQfcoBOnGcuHu3GZxYr02hDs59oZSAUCB4RhdUmqtf6x3rmjgUk0qjhwi16md5hc1genU t5SKamQF/bl8hYkQAzHua5ji2yDqH4QSTgdH0ECPFSAkW0usxjYJpL/dKaxmDHmC6yh7qLD0FOV8 alisSYg70l72b136NlBGEfRvByHw5tDD1k80InEwvRqZR3KVQgqF/fPYYAfEfsg8nBscCzVnvc2E I9tWBPTzMpWX+FgNDQeI6VmhcGZ+vDAbTvKYQWInrTFKMOoFXyG6vOzoFd2DQGQvxxyAdwScOMhK 7j8OXtK5RjKhMK7YRpgdCK9xgPAhizcnAHutlblbFY1EfB2nivpTgrpgM4cXTrOwOljnWIXmWIvm 7kY+T4c6c915YjVwAFXUCk0N8oStzieCQJlKaUg4ReXCnLJNHHASJNUmoOHSoqgqxfHmWSOR0sb9 WdIEH+IGYyyNamlkBjG6WiGl+htzf2RC8q6yB1qzPLpBWQJcrp+ZJKZSxjcw3g5UZfjmVzOIQoUJ k4E5Dy0kIn1S+xE6dEa4ITSOov/335ulnPf+GNLQABu1+zzbcjtkbfbmsS0625mCcoKBd7k7AwbM wYU5K3CT6jBDya+3Yyb2nO9stzOK8UYSnibotAOWGd02SeSvNxVfcGM= X-Report-Abuse-To: spam@se001.arandomserver.com I've tried various VCS prompts out and my favourite so far is https://github.com/woefe/git-prompt.zsh which is fast and also asynchronous. Nick On 08/09/2019 16:41, Roman Perepelitsa wrote: > On Sun, Sep 8, 2019 at 2:33 AM Bart Schaefer wrote: >> >> On Sat, Sep 7, 2019 at 1:19 PM Frank Terbeck wrote: >>> >>> Roman Perepelitsa wrote: >>>> Note that vcs_info is likely to make your prompt noticeably sluggish. >>> >>> Depends on configuration. The defaults avoid most features that are >>> particularly expensive. >> >> I've been using the following lately ... note that I am pathologically >> allergic to "setopt prompt_subst": >> >> ... > > I ran a few benchmarks to measure prompt latency induced by vcs_info > with conservative settings. By prompt latency I mean the time it takes > for prompt to appear after you hit ENTER. I've measured 3 > configurations: > > - bart: plain bart theme. > - bart + vcs_info: the config posted by Bart on this thread. > - bart + gitstatus: functionally equivalent to bart + vcs_info but > using gitstatus instead of vcs_info [1]. > > Prompt latency in zsh Git repo on a high-end desktop running Linux: > > - bart: 0.28ms > - bart + vcs_info: 28ms > - bart + gitstatus: 0.81ms > > The slowdown from vcs_info is significant but the overall prompt > latency is still reasonably low. If you pay attention, you can notice > the lag but it's not jarring. Most people start being annoyed by > prompt lag when it reaches around 50ms. > > The same machine running WSL: > > - bart: 2.1ms > - bart + vcs_info: 87ms > - bart + gitstatus: 4.9ms > > Here the lag induced by vcs_info cannot be ignored. Local shell feels > like SSH across the continent. bart + gitstatus stays far below the > perceptible lag threshold and feels instant. > > A typical laptop running Linux or macOS falls somewhere in between my > two benchmark setups, with slower macbooks being close in performance > to WSL on my desktop. > > To sum up, vcs_info with conservative settings adds enough prompt > latency to make it perceptible without any instruments. Whether it > makes prompt lag annoyingly high depends on the OS and hardware. > > Interactive ZSH has a reputation for being slow primarily due to slow > themes, which are in turn slow primarily due to suboptimal Git > integration. The difference in performance between fast and slow ZSH > bindings for Git is over an order of magnitude. vcs_info, while being > flexible, is one of the slowest. It's convenient to use vcs_info > thanks to its being bundled with zsh but but this convenience comes at > a great cost. > > Roman. > > [1] bart + gitstatus configuration can be obtained by appending the > following code to bart + vcs_info. > > if [[ ! -d ~/gitstatus ]]; then > git checkout https://github.com/romkatv/gitstatus.git ~/gitstatus > fi > > source ~/gitstatus/gitstatus.plugin.zsh > > # Start gitstatusd in the background and give it ID 'MY'. > # It'll terminate when the parent shell terminates. > gitstatus_start MY > > vcs-info-v() { > if gitstatus_query -p MY && [[ $VCS_STATUS_RESULT == 'ok-sync' ]]; then > # The current directory is inside a Git repo. > RPS1='%F{5}(%fgit%F{5})%F{3}-%F{5}[' > # Branch or tag or commit. > local b=$VCS_STATUS_LOCAL_BRANCH > : ${b:=$VCS_STATUS_TAG} > : ${b:=$VCS_STATUS_COMMIT[1,8]} > [[ -o prompt_subst ]] && b='${:-'${(qqq)b}'}' > RPS1+="%F{2}${b//\%/%%}%f" > # Add '<'/'>' after branch name if there are changes to pull/push. > (( VCS_STATUS_COMMITS_BEHIND )) && RPS1+='<' > (( VCS_STATUS_COMMITS_AHEAD )) && RPS1+='>' > # Action, a.k.a. state. For example, 'merge'. > [[ -n $VCS_STATUS_ACTION ]] && RPS1+="%F{3}|%F{1}$VCS_STATUS_ACTION" > RPS1+='%F{5}]%f' > else > # Not a Git repo. Call vcs_info in case it's a sv[nk]|bzr repo. > vcs_info > RPS1=${vcs_info_msg_0_% } > fi > } >