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.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 31941 invoked from network); 30 Nov 2021 08:28:08 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 30 Nov 2021 08:28:08 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1638260888; b=SGXgt4abjqsDhl+MJ9W5BChRh6J1TLTk55py/JZhTSHQN4fVNsk8fKYZZg7FoRZ6dIR3awTEOy YUBNMee1Ok3uVzZF4cItXBT/iR9tEF5gto9Kgja6NEedZhgKTaKjEpFMR1ysc5fPvWF84z0Rlr 7w5kJS2dwgFvNiU418OvXpwwSeAncD/dyc3a+i9WI+CdQMgqQDKCxsytYGcumzLAJZCjBhEVl8 N1Z6yJamPANZJrqUIvMN0tCDa8DAiMxwyGyjBU4WL1FTJr9w48U7yctijkn6XSILSc+PDDPZHN zsiP6PGHUd0sKTQdfPVtRf0XJMJywFlUoWDFpNWICWqnZQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-vk1-f180.google.com) smtp.remote-ip=209.85.221.180; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1638260888; bh=X+sdv1jp7oJsMnNSH70uqdJDNl9OYOuvHCdeo1cYY8M=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:References: In-Reply-To:MIME-Version:DKIM-Signature:DKIM-Signature; b=YlwWrShtXzEi54C4tjOb/lIMRH0sEhqxFQrZ4+uzge7ASXG83yalzEcWN+z63rMufhFuLBdSJi CkS4VrBpAJkUGDM1k3O8UysMtYd0pj9LDcc6e4KaOlpMUpZuLDBEIMmfKc8hVoutlHqnGY8hcq olNUxFaoXmMJm1H6/NSxUuwOZKwVH+30N2wPNCFU6krOLHm5J20iNor2yIrr9ejH4K9cWL7MZc +v4yrx+tIC7dnIKxKRKyILW6K/66cZHlCoRkyZuBzgZRgzqm2l22KnuvalwgajpS2753nQuBJX vvZ+jAcqaLRdZkezWHC5Kl6ymKua5N4dZvlN7GFk43+BgA==; 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:Content-Type:Cc:To:Subject:Message-ID :Date:From:References:In-Reply-To:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=GzNL1yZKcDO5itKE31HMRlfvpQq5haIrDZj12trX9Ew=; b=Mx2DN5OFKHvValYG7IUPxQUVJu oOwsL5SpA8Mv6W7FXQapfU8JCPnUFVo7BZaHMEDTA29/okCrhQftFvRqVU3IDf8lnwWinU6TUQ/7f aovMyRhXZjx3TwMqIMr9ykzoa7ozLfBu70mrDLvoVryx3OlEMMPsUKXOjRzVjespW0rMPn2aQMi8f nO/FAo8cU23P66Xr/0An10tSyI1k4QWgJ4Im4GMsYdg+66RMMkxL5sTUy8pyNvwzy7RBYaYPK1JsQ XcLoLWMeyGVPqMvYYrKq3i2xL1svad5Vzg1VKmVAbX2TeaEbv1lTGr4N3uh0Shn7IR7vqs1Sw18h8 XVwZ3f6g==; Received: from authenticated user by zero.zsh.org with local id 1mryUi-000FZW-JS; Tue, 30 Nov 2021 08:28:08 +0000 Authentication-Results: zsh.org; iprev=pass (mail-vk1-f180.google.com) smtp.remote-ip=209.85.221.180; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-vk1-f180.google.com ([209.85.221.180]:37847) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mryTw-000Eof-9f; Tue, 30 Nov 2021 08:27:20 +0000 Received: by mail-vk1-f180.google.com with SMTP id e27so13054132vkd.4 for ; Tue, 30 Nov 2021 00:27:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=GzNL1yZKcDO5itKE31HMRlfvpQq5haIrDZj12trX9Ew=; b=IrqMfOx4nv1/9+aI/KM7fRDbnCefBlZ3zKHOXPmuxWHlKiTCDVD42ARpQgtNkAtQ2L 2r6OHtoypMBQjrTKJvlBMY/f/JOyT3FUGPIkZ+WcOKFHpDaqNtqIsPGljCDiIyzBly3Z ECnlvGEnoNM4SY68PK6Ax37Zljnf++p4Js0ZEyRY4IuSd3T54nHP72bgRpXKcJvXa4ZH iRZiUK7SIcq6YWfA5wk99yg3gOd8Y7S0gGghsL3ovuzAnMDILvzaF90b6BNfX1ME2yKG Eq6zfNSATCsHAlF8qmeHzG2nvrprq5Pk8R3+JJJrdgBowF8v2hVarHGX1eZ7X5aYJmdt Ah4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=GzNL1yZKcDO5itKE31HMRlfvpQq5haIrDZj12trX9Ew=; b=L4/hn+zr3GJ/4p/pjvF9sSiM6w2V6kBkVYoB8yPp/TuzupXxMY9QTzcJJ80gzupfPP FuMWV0IXsEVT5GZXQeFCq4F2CNoWek6TUo+b4DCgKMROjoKgIDoMOOx00/j4Pztc+9fN /LN/Oq2SVsZXF8G2k5PBOt0927Jc/MzhGUVVtrUiWjo2R2X9Ob+ITm7M0K+tu7UNokbn SX9XhT1Ab8LvLLjYO+wyR2CBRmwE2o/MbGOrbtLzK6EjvGQSkAKDAUFGkj2KjDeuCfLQ ett2pd7LsKDn2FzDE8p/OvnG+5qMYi763yH8xlYGiZjyc3PNSYgvv3Jf4NaXUrUP33st vN6w== X-Gm-Message-State: AOAM530+fBnNXvXmCCYSX41jyqB6tRBpGJETnkhXOy0disbeBnBGhKEW j536ipCT0WUeVfjIm1JYLOVDh/oSng00X+nJ6A4= X-Google-Smtp-Source: ABdhPJxmwFb8Puv6HW3KXgsKRgEeXzGe2noFfiqW3+sykKHlEBc9RNICe86AAkHxvJ8UpM1CiDsKMn31DakP7GG0nAs= X-Received: by 2002:a05:6122:507:: with SMTP id x7mr42962192vko.18.1638260839448; Tue, 30 Nov 2021 00:27:19 -0800 (PST) MIME-Version: 1.0 Received: by 2002:ab0:2a82:0:0:0:0:0 with HTTP; Tue, 30 Nov 2021 00:27:19 -0800 (PST) In-Reply-To: References: From: Mikael Magnusson Date: Tue, 30 Nov 2021 09:27:19 +0100 Message-ID: Subject: Re: Shell startup, aliases vs. functions vs. autoloadable functions, and zcompile benefits To: Roman Perepelitsa Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" X-Seq: 27398 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On 11/30/21, Mikael Magnusson wrote: > On 11/30/21, Roman Perepelitsa wrote: >> On Tue, Nov 30, 2021 at 3:30 AM Zach Riggle wrote: >>> >>> The benchmark I used >>> >>> $ hyperfine 'zsh -i -l "exit 0"' >>> >>> >>> Obviously this is not the BEST benchmark [for checking shell startup >>> time] >> >> Obviously. It's the worst or at least a strong contender for the title. > > I think it's fine to do this (assuming he actually meant -i -l -c > "exit 0" (missing -c in the quoted command)), if you don't do any > weird stuff in your startup files (like you mention in your "how not > to benchmark" section). Assuming your startup files are synchronous, > the above will tell you how long it takes to execute your init file > plus some other overhead, so if you do something and the number is > lower, the thing you did will indeed make startup faster. If your > startup files are not synchronous, then obviously nothing I said > applies and everything you say is true. BTW, the above command can > easily be improved for worseness: > % time (repeat 1000; zsh -ic exit) > >> Since you care about interactive zsh performance, at least skim >> through the homepage of zsh-bench. It'll save you time. > > % ./zsh-bench > ==> benchmarking login shell of mikaelh ... > zsh-bench: cannot find prompt; make sure it contains hostname or the > last part of the current directory > > Sadly no time was saved :(. Got it running by changing prompt_pat to %, first_command_lag_ms=48.233 first_prompt_lag_ms=33.816 exit_time_ms=32.177 I'd say these values are fairly comparable :). It would be very useful to have an option to benchmark normal interactive shells instead of login shells btw, my profile runs stuff like fortune which is obviously pretty slow in comparison to startup code, and not at all interesting to benchmark. The quoted times in this mail is with all the -l removed. Also, you recommend against zcompiling .zshrc in your document, but first_command_lag_ms=56.709 first_prompt_lag_ms=42.367 exit_time_ms=40.885 Increasing startup time by 33% seems like a bad tradeoff to me, then again, I know exactly how things work and am not likely to make the mistake you mention. -- Mikael Magnusson