np you’re welcome

Note that this is special-cased (but easy enough to do and justify in
that place).

The variable must be set and have its content dynamically allocated
(normally so for strings previously set), not a special variable (like
IFS, PATH, etc.), not an integer variable, and not have the uppercase,
lowercase, or any of the left‑ or right-padding flags set.

For mere assignment (=) instead of appending (+=) the normal path is
fast enough, AFAICT. (0.29s to 0.43s appending on my $dayjob desktop,
though the difference is largely due to the string length.)

-- 
You received this bug notification because you are a member of mksh
Mailing List, which is subscribed to mksh.
Matching subscriptions: mkshlist-to-mksh-bugmail
https://bugs.launchpad.net/bugs/1855167

Title:
  Comparatively poor += performance

Status in mksh:
  Fix Committed

Bug description:
  Heavy use of += notably impacts script performance.  Consider the
  following micro-benchmark (pattered after real script content):

      i=0 s=
      while ((i < 30000)); do
        ((++i))
        s+=$i
      done

  which creates 138,894 character long string.  On my system (macOS
  10.14.6, 3.5 GHz i7), this takes ~8 seconds in mksh, compared with
  ksh's ~0.1s and bash 5's ~0.3s.  Here're `real' timing figures from
  my most recent run (these figures are quite stable):

  - mksh r57: 0m8.17s
  - ksh 93u+ 2012-08-01: 0m0.10s
  - bash 5.0.11(1)-release: 0m0.30s

  It's no surprise that ksh93 is much faster, given its heavy
  optimisation.  Striking, though, is the poor performance of mksh
  relative to the latest bash.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mksh/+bug/1855167/+subscriptions

Reply via email to