bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Revisiting Error handling (errexit)


From: Koichi Murase
Subject: Re: Revisiting Error handling (errexit)
Date: Fri, 8 Jul 2022 19:43:49 +0900

2022年7月8日(金) 19:29 Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com>:
> > >      ls -l /production/path | mail -s "all-good" notify@company.com ||
> > > true    # Not critical
> >
>
> small side note there, a || true is big slow imho

What does it mean? If you are talking about the execution time, "||
true" is much faster than spawning external processes like "ls" and
"mail". I've measured it in my system, but the overhead by "|| true"
is about 270ns (assuming the error basically does not happen if the
environment is properly set up) while the overhead by a pipe "ls -l |
cat -v" (where I replaced "mail ..." with "cat -v") is about
6630200ns. The main command is 2.5x10^6 times slower. In real cases, I
would expect that "mail" would take much more time than "mail". Even
if the main command does not "fork" or "exec" new processes, I believe
270ns is always negligible.

--
Koichi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]