zshrc: add `NOETCHOSTS` parameter
authorRoman Volosatovs <rvolosatovs@riseup.net>
Mon, 8 Nov 2021 10:53:59 +0000 (11:53 +0100)
committerRoman Volosatovs <rvolosatovs@riseup.net>
Sat, 13 Nov 2021 12:31:49 +0000 (13:31 +0100)
commitf444c52ee3ccb55bb312a074d38484a1b42c26c9
tree3a96b20dbb5607800c47d56f6420e39e51a92da0
parent42cdb33949473fc89a15b5ad0e8c202799f93b4a
zshrc: add `NOETCHOSTS` parameter

`/etc/hosts` may be used as a denylist for undesired hosts on some systems.
In such usage scenarios the file may be large in size and parsing it may severely
impact shell startup time.

For example, on a system with `/etc/hosts` from https://github.com/StevenBlack/hosts:

```
% cat profile.zsh
#!/usr/bin/env zsh
zmodload zsh/zprof
source ./etc/zsh/zshrc
zprof
```

```
% ./profile.zsh | head -3
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)    1        1181.93  1181.93   87.91%   1181.14  1181.14   87.85%  grmlcomp
```

```
% NOETCHOSTS=1 ./profile.zsh | head -3
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)    2          79.77    39.88   47.37%     79.77    39.88   47.37%  compaudit
```

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
doc/grmlzshrc.t2t
etc/zsh/zshrc