Hallo Thorsten,

while implementing 256-color support for my MUA i placed the
following script in the manual

  cat > t.sh << \!
  fg() { printf "\033[38;5;${1}m($1)"; }
  bg() { printf "\033[48;5;${1}m($1)"; }
  i=0
  while [ $i -lt 256 ]; do fg $i; i=$(($i + 1)); done
  printf "\033[0m\n"
  i=0
  while [ $i -lt 256 ]; do bg $i; i=$(($i + 1)); done
  printf "\033[0m\n"
  !

and when running it it seems that mksh(1) (this is @(#)MIRBSD KSH
R51 2015/07/10 packaged for ArchLinux) uses a (i'm guessing its
edit) line buffer until that overflows the first time, before
passing the final data through to STDOUT:

  ?0[sdaoden@wales tmp]$ time bash t.sh >/dev/null
      0m0.05s real     0m0.03s user     0m0.01s system
  ?0[sdaoden@wales tmp]$ time dash t.sh >/dev/null
      0m0.02s real     0m0.01s user     0m0.01s system
  ?0[sdaoden@wales tmp]$ time mksh t.sh >/dev/null
      0m6.76s real     0m2.04s user     0m4.28s system

--steffen

Reply via email to