Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15999

Re: performance bug of [[ $x ]]

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Chris Down <chris@chrisdown.name>
Newsgroups gnu.bash.bug
Subject Re: performance bug of [[ $x ]]
Date Sat, 7 Mar 2020 22:58:16 +0000
Lines 10
Approved bug-bash@gnu.org
Message-ID <mailman.2267.1583621904.2412.bug-bash@gnu.org> (permalink)
References <CABrM6w=ignEwgynRTYYbBLUNs=KVhE8WCf9h=kkgHj00QNoqmw@mail.gmail.com> <20200307225816.GA997327@chrisdown.name>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii; format=flowed
X-Trace usenet.stanford.edu 1583621904 2227 209.51.188.17 (7 Mar 2020 22:58:24 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash <bug-bash@gnu.org>
To Peng Yu <pengyu.ut@gmail.com>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=AkcbvEVuXsHJSBUpaiidXB0cMRTocN/hQSV8MaMH4Tc=; b=AIiLoqiwzteI2WHUKmc4p9HcfLgP2PC7oC/taPlovU1TogX+FhL4uO9Ly9lzIcUjp4 YF/mMk6f1KfF5YKaiM2ToJUCmfnhafYEQZYZ24DvWrOKN3mifc9XVcNPiF8SVLwyUNFE UaigZqgfWhJa1I4a3c5WWJxrayYFWOg09dUmI=
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=AkcbvEVuXsHJSBUpaiidXB0cMRTocN/hQSV8MaMH4Tc=; b=esS8OIlqHFMDlG7RxNA1bUKXqXSZH2AphGGhgxHUyDNgLaoGS4Exq9CXG80yx9Cwm4 MY7ZKUhMmbdUlSzk2eQKgK0Qh75d1vPd27UemiWPhvl2ZIqhcgTqYHSw79XDegEyFgZH mB9x5KcEQr6syD6VpHg5Mavq6SDT9ENcjKG9BNtDUY+8Z3BKBCTrdd05tPCSKCQVflhM A2F0pxAR/LkGXPOMQFo7qvSxObLf7l0+Lpm99dR/0koU7XNAC6hZCgVKQIl2bOJRGe1e /G6os6pVAVaDGWupWNg+ivZFsawHtEW/pCXeASiT4RcbFg2dZhtYlphlHcOarYoPAlfn prNg==
X-Gm-Message-State ANhLgQ3g5ebdjmQnle4z/d1Zee29CMZmHQqjtufqmhPvKn8TkLmg/Eqg QyMVu1WIAkbVplVbyyoZE2vHFQ==
X-Google-Smtp-Source ADFU+vv/XfsAogHQKzqSMW53HXWy28viHWVXx7OUk1811tnIJ96HeyRw1RC++3tiF0/AGCqmzx4nGA==
X-Received by 2002:a1c:9dc6:: with SMTP id g189mr7094819wme.91.1583621897739; Sat, 07 Mar 2020 14:58:17 -0800 (PST)
Content-Disposition inline
In-Reply-To <CABrM6w=ignEwgynRTYYbBLUNs=KVhE8WCf9h=kkgHj00QNoqmw@mail.gmail.com>
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2a00:1450:4864:20::32e
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <20200307225816.GA997327@chrisdown.name>
X-Mailman-Original-References <CABrM6w=ignEwgynRTYYbBLUNs=KVhE8WCf9h=kkgHj00QNoqmw@mail.gmail.com>
Xref csiph.com gnu.bash.bug:15999

Show key headers only | View raw


Peng Yu writes:
>[[ $x ]] just tests whether the variable $x is of length 0 or not. So
>its performance should not depend on how long the variable is.

Who said it has anything to do with the [[ builtin's performance? A shell does 
a lot more than just running one command.

For this and the last issue you posted, you could quite trivially find out the 
answer yourself using `perf` or another profiler.

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: performance bug of [[ $x ]] Chris Down <chris@chrisdown.name> - 2020-03-07 22:58 +0000

csiph-web