From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24320 invoked by alias); 24 Aug 2018 22:02:54 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 43332 Received: (qmail 21853 invoked by uid 1010); 24 Aug 2018 22:02:54 -0000 X-Qmail-Scanner-Diagnostics: from mail-oi0-f46.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.218.46):SA:0(-1.9/5.0):. Processed in 1.908605 secs); 24 Aug 2018 22:02:54 -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, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: sgniazdowski@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=iQatzM0Y6czUgLPXqQ4FXcWovBCq/Mg9P9ZMn3eGW/U=; b=mKWiYdXzaCgNDiT7aJb/+bDQ/iiyBNTXyOhmuG+fdemaI23BBlKx2v+PHCnE+Vl5qh G1nyiWZml2NHjNCJMqMNJSccaV+iFP9l2n8aWxcmF2RS2GtU0sZdHi9kXtlW6KhQztqJ XpA9cVfOq62MqrbHHhtp3cYvaibq2Ruo/YoGGRvrLQmTQXOPsHd4cuDFBZ7pPJX6mQMJ Ol6UnwXTzWUYFz3Amew2hyxKF7JvmomZtcl/vrFlwdkmw5b+9GCe6jicQdj6bXwah78v Q16SUFPqtjzvaAdrVY/noI+45T6Ire84ISt1ix48MwbGnyyfGQa/QHcH3mi1Bnf0ozNd ZVnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=iQatzM0Y6czUgLPXqQ4FXcWovBCq/Mg9P9ZMn3eGW/U=; b=JrMh24CjqmvUZljzFCiI8WhUyOSR63Q5fs4q1ot3pFIxYZs8JyA/9RSFlbTFKkRHIi gJj5PbdCnDiKVThKFOXcZwXN9TBPetnWV/NSny38AYPuHoosy+S8XyMcmU1f+23YaLR1 S3RpJBYefqk62Ea7K3WK+sa9jRYnYuy+9o42hfNv4JvUlh67AaLVwptfaZp9u9zTK842 Ghavapn1UAcGho0oNnWrxfdRjWdPf3+aIk2HMPniQwwCqluGb3IV34mIIKP1Jo+Lndja W1UllA8x44XP1g5RZ2a+yDCHtyvxevrs1NIRj8LWdENj6h2fuNllMtve4cXy8m4wbFzQ j+nQ== X-Gm-Message-State: APzg51C9EEOLNGUQ8AvxJ5/UijM+sURx2xw3cJmj1qiRuphST0UNUibD YPMpi/qa7FZ3KTnGjqdxUEeQKh6GJOUFM2rt4lgmDo+/ X-Google-Smtp-Source: ANB0VdaWnH0yh0WTWoe7NlAeTDos9Ipop86MXm14P+I7uWmAI8fejorbCQ1rakEP28ZG8xM6NhHIdj+x6H3kMJVgD9I= X-Received: by 2002:aca:f383:: with SMTP id r125-v6mr3305607oih.6.1535148168234; Fri, 24 Aug 2018 15:02:48 -0700 (PDT) MIME-Version: 1.0 From: Sebastian Gniazdowski Date: Sat, 25 Aug 2018 00:02:36 +0200 Message-ID: Subject: =?UTF-8?Q?Module_fun_=E2=80=93_automatic_compilation_of_sourced_scri?= =?UTF-8?Q?pts=2C_sourcing=2Dprofiling?= To: Zsh hackers list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello, just sharing that I've cooked up a module which: 1. Overloads bin_dot to implement: automatic compiling (i.e. calling of bin_zcompile) of sourced scripts with use of already existing two stat() calls (no new ones). This is a nice feature, because plugins not-rarely use many small helper scripts and it's really hard to track this with some ~/compile-all.zsh 2. gettimeofday() calling at beginning and end of init.c:source() (why not bin_dot, I now think), storing difference in a hash under progressing index, displaying list of all sourced scripts with duration in milliseconds =E2=80=93 a basic but capable profiling tool. Also= , no script can pass-through that place in code, and the resulting list of all sourced scripts can be surprising. The methodology is somewhat distinct, because when I e.g. wanted to use 2 already existing stat() calls, I've had to keep copying bin_dot() descendants until I've reached the needed function. So user of Zsh 5.1 will be using bin_dot and related code in version 5.5.1 actually. Source code of the module: https://github.com/zdharma/zplugin/tree/master/zmodules/Src/zdharma There's an install script, it clones to ~/.zplugin/mod-bin and builds the module, displays what to add to ~/.zshrc to load it: sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma/zplugin/master/doc/mod-install.sh= )" --=20 Sebastian Gniazdowski News: https://twitter.com/ZdharmaI IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin Blog: http://zdharma.org