Path: csiph.com!goblin3!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Eduardo Bustamante Newsgroups: gnu.bash.bug Subject: Re: Should [[ -v 1 ]] be supported? Date: Thu, 27 Dec 2018 21:56:26 -0800 Lines: 32 Approved: bug-bash@gnu.org Message-ID: References: <5dac2cf2-2fac-0fd1-058f-6a84a3271738@case.edu> <20181228013623.mersdxbzy64dpldp@crack.deadbeast.net> <20181228015710.tzzbejk36fsgr5wb@crack.deadbeast.net> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: usenet.stanford.edu 1545977330 21933 208.118.235.17 (28 Dec 2018 06:08:50 GMT) X-Complaints-To: action@cs.stanford.edu Cc: g.branden.robinson@gmail.com, bug-bash To: Peng Yu Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=E/8Es9Gy31fxAQOzOXus/6l+jxukCa4AdBW7O1iJw54=; b=rIGFBsZF/5J9Yi+Jq5xuE4P3osS2ws98yNhgeCYN5LaUsywpcf5UHUKX9eCynlo9zd af14wISCGgO3bZGgOZwZlEEKfHgoyEbMnvAFU9v2cYp7uhbVvYphbvbb6CkuCmZc6G/X S3OY1MqqXj+V21+YDosH0mg9Ib3Sx/3/Fp5SkjN2x1FI4zmBbQAz43m1/4fMmaI01aii vtaNWUV8P0FTCFWMLP4e6GoYq8/nrCOJ0oo0C+JG5A3Rx4NHoSscUO7TUKrrkb6j5Mcg +nj2up2jbH7A3ygx1lD+BNh1DUyOxMR7B3hxi4KTnBdjA2hdoiRuZRfTV1dC+1J4PQh6 tZIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=E/8Es9Gy31fxAQOzOXus/6l+jxukCa4AdBW7O1iJw54=; b=Gcmasn3sR5pbPlHdibYiecqeP5bEib2362KB24UIuD0VL4hSVxiOY1DmjWqim8KS/T KNc9AzHRv09rxmO+LRonOf61T39s7bqWeGvrkr/EvXAFVamB6HLH1PKI3ORgU3SsFLVX UfnlPYJS1XkqudPB73hg8J7jjNZ/L+gMc4PN/oodDSRmPyhU7si3bMM6a/t67aweegpn mC8mquOxopH+eB0VFk4S3QF/+8FXhgg9jFOAzvBp3wQ4TDN8ADyyPJT2iLOmUB1nnoy1 3v36bW6z9TLYnzG1zhL52Xe1cDumJyQN/3sXQYQz5NO5BApGf4+/WBTJ2yHp0cmiZ/lw tN+A== X-Gm-Message-State: AJcUukdV3BNcxllJuaxj/G3xeIMQjnxUq4k/j8gLUU8LSAINoMwB9Jd0 WyOCiil0amtZPpG6LHC9axjdkM0tkGLUjsoPZFU= X-Google-Smtp-Source: AFSGD/WRGJmx3fSJtsvUxT1mA/ljx+OUaHcNLAhQj1lb301poEsKL9RvhyXFYqVBho+FqXjQM9Gs86FzauM5PfzPXyI= X-Received: by 2002:a2e:2f15:: with SMTP id v21-v6mr15300683ljv.56.1545976600916; Thu, 27 Dec 2018 21:56:40 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::243 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:14987 On Thu, Dec 27, 2018 at 9:45 PM Peng Yu wrote: (...) > Yes and no. For a particular bash script, you can quantify which bash > features are the most time-consuming. (...) > (...) But you can not profile all the > bash scripts that have ever been written. Since there are only limited > features in bash, in this case, a logical way to go is to at least > profile each commonly used feature with minimal code (as just for and > repetitive calling that features as I do) and understand its pros and > cons. Err, where did you get this profiling advice from? :) It's not great. You're just picking arbitrary expressions from a script w/o understanding how they contribute in terms of % of time spent by your program, then assume that tuning that is going to produce *significant* benefits. Furthermore, your testing/measuring is not really systematic, so the numbers you get aren't really meaningful (are they specific to your system? or to the way you compiled bash? are you taking caching and system load into consideration? variability? etc.) > (...) A profiler is an overkill in this case. A profiler is exactly what you need here. You should profile your script and understand the stuff that actually matters for your goals. Otherwise you're just chasing unimportant things. Honestly, if you're not willing to provide more context as to why these areas should be optimized, then I'm just wasting my time here.