Public bug reported:

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.

** Affects: mksh
     Importance: Undecided
         Status: New


** Tags: performance

-- 
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:
  New

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