From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from plg.uwaterloo.ca ([129.97.140.10]) by hawkwind.utcs.toronto.edu with SMTP id <2748>; Fri, 9 Apr 1993 15:23:31 -0400 Received: by plg.uwaterloo.ca id <28723>; Fri, 9 Apr 1993 15:22:27 -0400 From: Dave Mason To: rc@hawkwind.utcs.toronto.edu In-reply-to: <199304100239.22248.rc.bagiy@civil.su.oz.au> (john@civil.su.oz.au) Subject: Speed of rc X-Face: %Q_F^9R-:'3MM7eZ6@E.x@f\*bgatzGv-8d%I~L[p^.F)3QF{kq\UTsu|e#?)3FPwJNvPPB !s*He|-*M^p*~bh"Nywm5NLL\\Rl3r(hWHY*F:$/RdKV*bS";n&#\Ov@*=]mu\}6tP Date: Fri, 9 Apr 1993 15:22:14 -0400 Ignoring rude comments about my conjectures... John is of course right, that in his tests both sh and rc had the same environments, so the environment copy time will be the same (although from his numbers it's clear this is a significant cost and it may be worth looking for a different way to handle environments on Unix) and we have to look for other differences... Well, the obvious one (for me) is that /bin/sh is built to be static, and when I built rc and es, I took the sun defaults which build to use dynamic libraries. So I tried John's test looking at the system calls for static and dynamic cases... essentially no difference... But the execution time is very different. At least on this Sun 4/590, dynamic libraries cost a lot of system time, and when I run static versions my rc has virtually identical system times as sh and es only uses about 7% more system time (which may well be because of the 3 times larger binary and demand-load paging). (And es' *total* time is within a couple percent of sh.) John's mileage may vary. (e.g. if he's not running dynamic libraries.) Paul & Byron: any idea why the es executable is so large? ../Dave ; /bin/time /bin/sh -c '/bin/cat pus2 | /bin/sh' ; /bin/cat pus2|trace -c /bin/sh rc-stat rc es-stat es sh 90K 82K 286K 163K 106K text+data size 1.4 2.3 1.1 2.0 4.6 user time 32.5 44.2 36.0 49.3 32.4 system time 37.5 49.4 40.9 58.9 40.1 real time 1059 1068 1007 1064 1076 wait4 1076 1076 1062 1062 1071 sigblock 1034 1034 1023 1023 1063 sigstack 1000 1000 1000 1000 1000 SIGCHLD (20) 1000 1000 1000 1000 999 fork 78 78 72 72 14 sigvec 41 41 38 38 7 sigsetmask 1 1 1 1 1 exit 8 8 9 9 brk 1 1 1 1 getpid 1 1 1 1 ioctl 1 1 1 1 getpagesize (Some or all of the following calls are attributable to Dynamic libraries): 33 36 9 12 63 read 7 14 7 14 4 close 3 10 7 open 1 2 1 getuid 1 2 1 getgid 10 10 mmap 4 4 getdents 2 2 fstat 1 1 getrlimit Only rc: 1000 1000 stat 1 1 getgroups Only es: 3 3 dup 1 1 sigcleanup (As an aside, I find it interesting that there is little correlation between the number of wait4, sigblock and sigstack calls among the shells, and I don't see how sh gets 1000 SIGCHLD's with only 999 forks! But this is repeatable: sh definitely elides the last fork. Whether that optimization is worthwhile is unclear.)