Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Why sourcing a file is not faster than doing a loop with eval, zle -N
- X-seq: zsh-users 22738
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- Subject: Re: Why sourcing a file is not faster than doing a loop with eval, zle -N
- Date: Mon, 19 Jun 2017 12:14:24 -0700
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject:cc :mime-version; bh=aKAB7v8G6gOP83hdM5dW05sNQrs78Pgq18VmmCAT4Rg=; b=rRkXh9h4UEPYRfTUm5yFp1qNIHnk8TWQJOqBQhddVdG9FrDfrNKXHskLJX3dagAs72 f2EC9Ab7RHpkPl9oNvMZfI1anyMyc69ywo7cQBw0gkFvALrxJpkQH8Nh9VrUtKVWrrGH ENbWsbAPAMnsP6WiVq/D45QFXDg1Ej7/31ATYeQYyGCCI8z1WTs+lJec1y0xRnBGk29X m2J635dPw/DzlIrhr9LR8kfxv0iU01FC7RrPu0nMW9eygxIE0aMy7RFa5VUG056Pw3eg FDbFRP1ZDlvn9AsbwCmD9eqWYlHhShgS7v1umOFifAhYb+O5mMH5IZrELn6h3cWLmosp UI/A==
- In-reply-to: <20170619161601.GB9294@chaz.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <etPan.594513a8.516100cd.10b2e__10513.1716504276$1497699329$gmane$org@zdharma.org> <20170619122413.GA9294@chaz.gmail.com> <170619083116.ZM17323__41722.0601499595$1497886320$gmane$org@torch.brasslantern.com> <20170619161601.GB9294@chaz.gmail.com>
This is now WELL into zsh-workers territory, please direct replies there
rather than to the -users list.
On Jun 19, 5:16pm, Stephane Chazelas wrote:
}
} That defeats a benefit of stdio saving read() systems calls by
} reading in chunk if we end up doing one system call per byte
} anyway.
Unfortunately we need to read from stdio one byte at a time, and
as far as I know there is no way to "ask" stdio whether it is still
working on a buffer, or is instead going to refill its buffer (and
therefore possibly block) on the next attempted getc() -- and to
find out would likely be more expensive than doing the system call.
Also stdio is *itself* not re-entrant, so we have to control signals
around all stdio operations.
Just to demonstrate why the signal handling is necessary; consider
this:
% echo $(trap '' INT; sleep 100)
That shell is now un-interruptible for 100 seconds, because readoutput()
does not do signal management around its fgetc() calls. Worse, if you
type ^Z the sleep is silently suspended and the parent is hung forever.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author