tags 819279 + moreinfo
thanks

Hello Jeffrey,

>The following typescript demonstrates the problem,

it demonstrates the problem only somewhat.

>    $ time . /home/jeff/.sh_env
>    0=mksh, 1=.sh_env, EUID=1001, PWD=~jeff, #=1
>    0=mksh, 1=.sh_usr, EUID=1001, PWD=~jeff, #=1
>       0m0.21s real     0m0.10s user     0m0.01s system
>
>    19:25 9 jeff ~ mkshR50-$ time . /home/jeff/.sh_env
>    0=mksh, 1=.sh_env, EUID=1001, PWD=~jeff, #=1
>    0=mksh, 1=.sh_usr, EUID=1001, PWD=~jeff, #=1
>       0m25.91s real     0m25.67s user     0m0.02s system
>
>    19:25 9 jeff ~ mkshR50-$ time . /home/jeff/.sh_env
>    0=mksh, 1=.sh_env, EUID=1001, PWD=~jeff, #=1
>    0=mksh, 1=.sh_usr, EUID=1001, PWD=~jeff, #=1
>       0m27.18s real     0m26.94s user     0m0.01s system

Are these run immediately in succession?

Without looking at the contents of the .sh_env file, I cannot
say anything about it. It’s possible that “reloading” does
different things, such as append to a string instrad of set it,
or somesuch.

You could try tracing, with set -x and possibly -o inherit-xtrace
(but probably not), or sprinkling 「echo "[$EPOCHREALTIME] $LINENO"」
into the file, and then using…

| perl -pe 's/^\[(\d+)/my $r = $1 - $last; $last = $1; "[".$r;/eg;'

… to analyse where, if any, the slowdown happens. (Explanation:
with PS4='[$EPOCHREALTIME] ' the trace output is præfixed by the
current Unix timestamp; the script replaces that by the delta to
the previous line’s timestamp. Sort to quickly spot outliers.)

If this is legit… you could also prepend the following to your
ENV file:

| [[ -z $env_file_already_read ]] || return 0
| env_file_already_read=1

HTH & HAND,
//mirabilos
-- 
“It is inappropriate to require that a time represented as
 seconds since the Epoch precisely represent the number of
 seconds between the referenced time and the Epoch.”
        -- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2

Reply via email to