From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Module fun – automatic compilation of sourced scripts, sourcing-profiling
Date: Sat, 25 Aug 2018 00:02:36 +0200 [thread overview]
Message-ID: <CAKc7PVAtGK96JVUGEsFSyJrZ1wOmnA5E8RHz6McYQ_rLDWg91A@mail.gmail.com> (raw)
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 – 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)"
--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org
reply other threads:[~2018-08-24 22:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAKc7PVAtGK96JVUGEsFSyJrZ1wOmnA5E8RHz6McYQ_rLDWg91A@mail.gmail.com \
--to=sgniazdowski@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).