| Deutsch English Français Italiano |
|
<vff7qe$31ohp$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups: comp.unix.shell
Subject: [ksh93u+m] Performance warning message
Date: Fri, 25 Oct 2024 06:46:05 +0200
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <vff7qe$31ohp$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 25 Oct 2024 06:46:07 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="b0051abdce59c21a789bf51cbdb0a4ac";
logging-data="3203641"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ACwe3I2GFfLVaMMikXMNn"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:pzRamMPWNmJCKkvjhmpEHu+W5Ho=
X-Mozilla-News-Host: news://news.eternal-september.org:119
X-Enigmail-Draft-Status: N1110
For this command
typeset -i indents=$(( level * indent_factor )) ###
with two integer variables, 'level' and 'indent_factor', declared
I'm getting this nice warning message
warning: line 28: indents=$(( level * indent_factor ))
is slower than ((indents= level * indent_factor ))
I thought (to avoid the warning) I'd have to split the lines like
typeset -i indents
(( indents = level * indent_factor ))
but I noticed that we can also write
(( typeset -i indents = level * indent_factor ))
(I wasn't aware about the 'typeset' command possible in arithmetic
expressions.)
Though I wonder why Ksh doesn't silently optimize the '###' marked
code since Ksh optimizes so many less obvious and much more complex
things.
Janis