From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23558 invoked by alias); 10 Feb 2016 09:20:13 -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: X-Seq: 21263 Received: (qmail 25728 invoked from network); 10 Feb 2016 09:20:12 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=dfEFtHSpASqTllLhO1QEEt8v8qYLKbIleB2rSCVxwUs=; b=ZHjCsyQHtFaxusfxTX7s3gNTxDJ5PNGC5cDdKnuU1v9fNNhx8dG9aRXm6UlS3Agh+Q hD8ut/Z11CkXKkQbwaC8fxscN+beRM73wG72xx0KbanTjXM811gF7p8dlw6epAETQSc+ aewbHzQBuaO1pbV7r8FzJGM/X3B4BoWLBlEhKi74AiHWromEDyrUNvfF+XYErjr09EUE AqLkOKe2qjQKw0yGRfVrbAU0F2+IcNkcTx+Zt3N+UklpN7jGGLIV0WEM+q3sk7NnEsoi TOf/yxnEH2UvxX+4nBcMs02VYOUm08h+8mVgh5xRiLndzquO0hnsbd2xu1wvo6kWBph9 XQ3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=dfEFtHSpASqTllLhO1QEEt8v8qYLKbIleB2rSCVxwUs=; b=kwmiG4vnYQJmrf/C0Ic7q69KsEWCbPrCDdAKJS9IZUavkDWJ/8G2FvPNSx6xeGBbdC YzmdnVMUKcVlc+GV4zm0F3Fuq/1OL2yxtWG/dP0OvyCI4Bh696Vb/Tn4iSbdGVnCI/9A h+plBwD4I+maPouophB2n7yCnA+XxKdUNQW6OaDaQnjvxkh4t7ISJfzQr35Qb8HPmsfX eN/yb/WyonhF511NnQ3PINyX3fXmTqaFX1FSwBe6X12nignTEDl8no9F5rz5bJl4a6eV b9sIlJr4XksBqiMim706YuDVWTYKwHoIsmRZD3BeV9TMFT6uhukY1GEwqQwsPhEOpXII NadA== X-Gm-Message-State: AG10YORpbzW/myrHU2LmaUwcWj21Hy0FloN2eqOOFlqCfsvOayCPAydSQQZjSdOWrqREyLkPDXqLjsV2J0c0Zw== X-Received: by 10.112.137.129 with SMTP id qi1mr15516213lbb.31.1455096009586; Wed, 10 Feb 2016 01:20:09 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: From: Sebastian Gniazdowski Date: Wed, 10 Feb 2016 10:19:50 +0100 Message-ID: Subject: Re: New zplugin feature (was: Re: How completions work, do they require fpath?) To: Bart Schaefer Cc: Zsh Users Content-Type: text/plain; charset=UTF-8 Well, actually, antigen snippet I showed implements this too :D In Advanced Bash Scripting Guide style (thus not fast), but still, they do it. Best regards, Sebastian Gniazdowski On 10 February 2016 at 10:08, Sebastian Gniazdowski wrote: > On 31 January 2016 at 20:26, Bart Schaefer wrote: >> You could try this: Define your own "compdef" whose only action is >> to cache its arguments somewhere. Load all the plugins, then after >> compinit is run, play back the cached compdef arguments with the real >> compdef. > > I realized how great that idea is. Implemented it in zplugin, thus an > idiom is possible: > > source '/Users/sgniazdowski/.zplugin/bin/zplugin.zsh' > zplugin load "some1/plugin1" > zplugin load "some2/plugin2" > ... > zplugin load "some3/plugin3" > autoload -Uz compinit > compinit > zplugin cdreplay -q # -q is quiet > > The difference between running compinit once and twice is huge, > following time differences are possible: > zsh -i -c exit 0,73s user 0,25s system 99% cpu 0,980 total > zsh -i -c exit 0,11s user 0,04s system 97% cpu 0,156 total > (for 3 plugins) > zsh -i -c exit 1,24s user 0,41s system 99% cpu 1,667 total > zsh -i -c exit 0,48s user 0,18s system 98% cpu 0,668 total > (for 40 plugins) > > This is a very innovative, great thing. All current plugin managers > drifted towards double compinit calling, by force of lack of > shadowing: > https://github.com/tarjoilija/zgen/blob/master/zgen.zsh#L471-L475 > https://github.com/zsh-users/antigen/blob/master/antigen.zsh#L441-L462 > > OMZ slowness is I guess also result of this. > > Fun example: > % unfunction compdef > % zplg dtrace > % compdef _ls cp > % zplg dstop > % zplg cdlist > Recorded compdefs: > compdef _ls cp > % zplg cdreplay > Compinit isn't loaded, cannot do compdef replay > % autoload -Uz compinit > % compinit > % zplg cdreplay > Running compdef _ls cp > % echo $_comps[cp] > _ls > > Best regards, > Sebastian Gniazdowski