[gnu.bash.bug] Efficiency is important

ray@GIBBS.PHYSICS.PURDUE.EDU (Ray Moody) (06/14/89)

    Bash prints its prompts to stderr.  Stderr is unbuffered.  Thus,
bash makes one (expensive) write () system call for each character it
prints.  This eats our poor VAX 11/750 alive.

								Ray
-------------------------------------------------------------------------------
RCS file: RCS/shell.c,v
retrieving revision 0.99.1.2
diff -c -r0.99.1.2 shell.c
*** /tmp/,RCSt1023214	Wed Jun 14 00:54:32 1989
--- shell.c	Wed Jun 14 00:54:01 1989
***************
*** 188,193
    if (shell_initialized)
      shell_reinitialize ();
  
    /* Here's a hack.  If the name of this shell is "sh", then don't do
       any startup files; just try to be more like /bin/sh. */
    {

--- 188,198 -----
    if (shell_initialized)
      shell_reinitialize ();
  
+   /* Added Wed Jun 14 00:53:21 EST 1989 by Ray Moody */
+   /* We call setlinebuf () so that the readline package does not use
+      one (expensive) write () system call for each character it prints. */
+   setlinebuf(stderr);
+  
    /* Here's a hack.  If the name of this shell is "sh", then don't do
       any startup files; just try to be more like /bin/sh. */
    {

james@bigtex.cactus.org (James Van Artsdalen) (06/15/89)

> Date: Wed, 14 Jun 89 00:59:41 EST
> From: ray@gibbs.physics.purdue.edu (Ray Moody)

> +   /* Added Wed Jun 14 00:53:21 EST 1989 by Ray Moody */
> +   /* We call setlinebuf () so that the readline package does not use
> +      one (expensive) write () system call for each character it prints. */
> +   setlinebuf(stderr);

This needs to be conditionalized on BSD or something.  The system V
method is to call setvbuf(stderr, buf, _IOLBF, sizeof buf).  We get to
supply the buffer.  I've no idea who releases that buffer, but I guess
we needn't worry about it.
---
James R. Van Artsdalen          james@bigtex.cactus.org   "Live Free or Die"
Dell Computer Co    9505 Arboretum Blvd Austin TX 78759         512-338-8789