Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Module fun – automatic compilation of sourced scripts, sourcing-profiling
- X-seq: zsh-workers 43332
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Module fun – automatic compilation of sourced scripts, sourcing-profiling
- Date: Sat, 25 Aug 2018 00:02:36 +0200
- 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==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author