[ksh93u+m] Performance warning message

Liste des GroupesRevenir à cu shell 
Sujet : [ksh93u+m] Performance warning message
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.unix.shell
Date : 25. Oct 2024, 05:46:05
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vff7qe$31ohp$1@dont-email.me>
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
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

Date Sujet#  Auteur
25 Oct 24 * [ksh93u+m] Performance warning message4Janis Papanagnou
28 Oct 24 `* Re: [ksh93u+m] Performance warning message3Janis Papanagnou
3 Nov 24  `* Re: [ksh93u+m] Performance warning message2Martijn Dekker
3 Nov 24   `- Re: [ksh93u+m] Performance warning message1Janis Papanagnou

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal