home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / mod.std.unix.v4 / text0005.txt < prev    next >
Encoding:
Internet Message Format  |  1987-06-30  |  2.3 KB

  1. Date: Thu, 5 Dec 85 16:45:19 cst
  2. From: allegra!jpl (John P. Linderman)
  3.  
  4. I decided to do a little testing to see how much the size of my
  5. environment affected response time.  I wrote the following korn shell
  6. script, and ran in on an unloaded (but not singleuser) VAX 8600.  Each
  7. main loop runs /bin/echo 1000 times, with exported variable ``a'' doubling
  8. in size each time through the outer loop.  I unset as much as possible,
  9. to minimize the environment, as the export at the start shows.  Adding
  10. a seventh iteration to the outside loop made the environment too big.
  11. All the commands in the inner loop except /bin/echo are shell builtins,
  12. so there should be only one fork and exec per iteration.
  13.  
  14. #!/bin/ksh
  15. a="`cat /etc/fstab`"
  16. unset MAILCHECK RANDOM
  17. export
  18. export a
  19. for i in 1 2 3 4 5 6
  20. do
  21.     export | /usr/ucb/wc
  22.     /bin/date
  23.     j=0
  24.     while let "j = j + 1"  "j <= 1000"
  25.     do
  26.     /bin/echo abc > /dev/null
  27.     done
  28.     /bin/date
  29.     a="$a
  30. $a"
  31. done
  32.  
  33. The results follow.
  34.  
  35. HOME=/
  36. PWD=/
  37.       10      10     181
  38. Thu Dec  5 10:51:01 EST 1985
  39. Thu Dec  5 10:52:12 EST 1985    ( 71 seconds)
  40.       18      18     347
  41. Thu Dec  5 10:52:13 EST 1985
  42. Thu Dec  5 10:53:40 EST 1985    ( 87 seconds)
  43.       34      34     679
  44. Thu Dec  5 10:53:40 EST 1985
  45. Thu Dec  5 10:55:11 EST 1985    ( 91 seconds)
  46.       66      66    1343
  47. Thu Dec  5 10:55:11 EST 1985
  48. Thu Dec  5 10:56:59 EST 1985    (108 seconds)
  49.      130     130    2671
  50. Thu Dec  5 10:56:59 EST 1985
  51. Thu Dec  5 10:59:02 EST 1985    (123 seconds)
  52.      258     258    5327
  53. Thu Dec  5 10:59:03 EST 1985
  54. Thu Dec  5 11:02:35 EST 1985    (152 seconds)
  55.  
  56. There are many possible interpretations of the data, of which I am
  57. certain we'll hear several.  I hadn't expected the size of the
  58. environment to matter as much as it did, but the bottom line for me, on
  59. my nice fast machine, is that the biggest environment I'm allowed to
  60. carry around adds at most a tenth of a second to a fork+exec.  The
  61. actual environment I carry around (about 900 bytes) adds somewhere
  62. around 3 hundredths of a second to that cost.  I simply don't execute
  63. enough processes in a day for that to make a difference.  On a slower
  64. machine, my interpretation might be different.  I'd be curious to
  65. see the results of a similar test on other machines.
  66.  
  67. John P. Linderman   Environmental Studies Department  allegra!jpl
  68.  
  69. Volume-Number: Volume 4, Number 6
  70.  
  71.