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,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1957 invoked from network); 27 Nov 2021 08:11:12 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 27 Nov 2021 08:11:12 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1638000672; b=TZedNXa0ZZIthZbu9XvrPXuZQ0zSejMj9PAeQiXKpoX+UF4ngB4lnWCSxuE4/MDvYD9BWaK9vV ATHSVGDEkzFKCrslDIc2lRdvN/7kqs8PhTTE/6X+hNzjEoFkvoZWSaT4GCEAvZ1bTRCAEIttsv U6tqRKMXmVvKVQUGwU8MEiLjqBy7YEfi81IRH1E1+CUTN8a3ZBKqvMYktJ9kQoyT/hZyuA7OOY RQzkz69x0epLdFmwDympuytvg+zL3m2KMIZ5TQlFOaou/pPzipT80+1Blf6Gm38EjfbMtfSBrP cUt9ZT7l36who/TLBsq0ep5uV8AqAsAHViQT0diqq2cFlw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-wr1-f54.google.com) smtp.remote-ip=209.85.221.54; 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=1638000672; bh=WjkIx2sxQIP/cHRWUGEdxmI3fk6RT/lYW+RdGOB9r8w=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:MIME-Version: DKIM-Signature:DKIM-Signature; b=qdIIBPq7wZ2bscYiRnmZFF4++Ep2xei+nDxbWjxCsyn6+wX3Kab0e3a/ouzTTUm7s/2AApmIy+ 73WmzMTEVbRh2uscB7cm6Tgy6+/9hKIe1LHZzKsClo7gidLrz7T6wMKFM9JXc8hFse11patwvH mMxa26lfD7F7T4900LjZKM+g+T1QOm18jD+dRFzlrJbZLPwQyTIk9n1ucUYCniWcadq7y+cHso zVkH2Ku+Youx+eOnpw0CA0RA7iaX3Q+fxc95apcAqOEh3ElbvU3C+borqs6qeDZQZvYnl9/m6+ NZf/h+z0fYDdcp1/5UB9QDcGrLGNjJkhAsWe60eHnnCPZA==; 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:To:Subject:Message-ID: Date:From:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=aeVDMRxXF+xZz6DWph8x1eYKRfCnaOfOVnRSp/rG4ow=; b=nIJTPQow2rHW41l8x4yFynd6eR 8Qh+1ku0WPfFN0n/nmjZWZNk7Q/nG1o+4UQWei483iGHZwbgJzT8xOsnN+SR3daf2hKPVGNZI3OHm rAOY5c/goxkbzbhaEgfHzh2Yk6BcY6+QW3k5NmQGaXmEtY59LtbQUozo6MkbIN3XKAOafPTYcT1W7 H7DhZfRNdEXeqxQwRrHiqn44QB1aWraZVCADYLMgdYHoe7ipTEU67031+5Kl2y4LUfxZSspasOpDI N1OrjzKExdtSQ5sXAkc35wCsjN2BflIJsJErR4uzRZzlAQJ0BZMRHloJOdsyqGJwzvc+4gzkcuoAJ c2/RRVXA==; Received: from authenticated user by zero.zsh.org with local id 1mqsnf-0001aj-TA; Sat, 27 Nov 2021 08:11:11 +0000 Authentication-Results: zsh.org; iprev=pass (mail-wr1-f54.google.com) smtp.remote-ip=209.85.221.54; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-wr1-f54.google.com ([209.85.221.54]:39667) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mqsmt-0000oz-PP; Sat, 27 Nov 2021 08:10:24 +0000 Received: by mail-wr1-f54.google.com with SMTP id a18so23654696wrn.6 for ; Sat, 27 Nov 2021 00:10:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=aeVDMRxXF+xZz6DWph8x1eYKRfCnaOfOVnRSp/rG4ow=; b=NkoTKed0n2Z/E0bQBDjf9dycgC9g6u4BHYs6AsoLrGWzblrJILtQX91YtsK6Ys8L2G AZ0mEDFafXVZKckd42boUHfDZx12/cPe0tFBzVMs2jyssNkk+PmZ3Sbjs9ZuE77m9i5I 4tkcAOaRqUrr0eprIlbQLU4TYJ8xtCQDKVbbJNOr5lcrC+J3L13cjnVglgVwu/jhnswj 1B536sG7jlpUYaDFS6bmi0FCOConcESOSb7zgqliEFdlTPT/qxJ9MI2BkkGUVw5bTtEk 8zG9rBgTY6lXAU4tl/nQAToIXQeHEz4qJOyal49lIcQuJYXtbZ/j9YXamLfetJUDvz2Y M6Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=aeVDMRxXF+xZz6DWph8x1eYKRfCnaOfOVnRSp/rG4ow=; b=eKyNwo1WSVE3BzHk3ulgOpBs3iboixDlmam5J+Arhw/AxHH0KbgfmuwF0O4qF73PbC XG7DLWx9og1gmP5rfVCheCGOinZ+P3IO6QLWI6JM7MXFH+2ZzNEdW9J+ej4uvVPciY7a EwLXHjnImfO2r2j40qADr7GcFj/hEEUUpya3yWB9j2s/jQ9VW2IwMQcVfuV/Mxtjhoso 0P/W8Cozsl9i5F1UtuITrkluNUOWvHGVH+Z8nxeauFOqplfv/0ibrQ3mCdFwbp2yuIXM Edx9Ud1N+jZA9HqD2m2RUt+1DrWdtJi2W9uz/cyDXuKSNlE0/oGQI0ydLGcLF8YirNtA P+2w== X-Gm-Message-State: AOAM532K6c+29lfIGZRGLLABPaqWssSzv7li7EtvoyO5zJWAfuq/h+OE CSfsjIH00wBtOoerZzCE1IJqhVf1wwoOFcxp3Mg9GgOlP391Dw== X-Google-Smtp-Source: ABdhPJxApjVCFHYpP97AD1/ZCi3DAPqLUfboChTokb0SA/rFTaEkPCZuXTI9Y3zn0uxCPjv+4N91WBUAzRj9Oe+fDUc= X-Received: by 2002:a5d:69c5:: with SMTP id s5mr19243008wrw.283.1638000623201; Sat, 27 Nov 2021 00:10:23 -0800 (PST) MIME-Version: 1.0 From: Zach Riggle Date: Sat, 27 Nov 2021 02:10:12 -0600 Message-ID: Subject: Shell startup, aliases vs. functions vs. autoloadable functions, and zcompile benefits To: Zsh Users Content-Type: multipart/alternative; boundary="00000000000049b0cb05d1c0bd52" X-Seq: 27368 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: --00000000000049b0cb05d1c0bd52 Content-Type: text/plain; charset="UTF-8" I've started playing with moving many of the functions I've declared in a script with most of my aliases, and migrating them to their own file in a directory contained by $fpath. I'm not sure if this is overall a net performance gain to defer the various aliases / function-wrappers-as-aliases to autoloadable modules, but it seems fun. Does anybody have information on which approach is faster? 1. alias foo='foo --flag1 --flag2' 2. foo() { command foo --flag1 --flag2 "$@" } 3. autoloadable module containing (2) Finally, I'm aware of the zcompile tool to create .zwc bytecode files, but it appears that this causes issues with $functions / $functions_source and sometimes things don't work. Is there a true performance benefit in the general case for pre-compiling ALL of my zsh scripts (i.e. everything inside ~/.zprezto that /usr/bin/file says is a "zsh script text executable")? What are the benefits / trade-offs / caveats of doing this? *Zach Riggle* --00000000000049b0cb05d1c0bd52 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I've started playing with moving many of the functions= I've declared in a script with most of my aliases, and migrating them = to their own file in a directory contained by $fpath.

I&= #39;m not sure if this is overall a net performance gain to defer the vario= us aliases / function-wrappers-as-aliases to autoloadable modules, but it s= eems fun.=C2=A0 Does anybody have information on which approach is faster?<= /div>
  1. alias foo=3D'foo --flag1 --flag2'
  2. foo() {= command foo --flag1 --flag2 "$@" }
  3. autoloadable module c= ontaining (2)
Finally, I'm aware of the zcompile tool to = create .zwc bytecode files, but it appears that this causes issues with $fu= nctions / $functions_source and sometimes things don't work.=C2=A0=C2= =A0

Is there a true performance benefit in the gen= eral case for pre-compiling ALL of my zsh scripts (i.e. everything inside ~= /.zprezto=C2=A0that /usr/bin/file says is a "zsh script text executabl= e")?=C2=A0 What are the benefits / trade-offs / caveats of doing this?=

Zach Riggle

--00000000000049b0cb05d1c0bd52--