<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>A lot of those numbers didn't make sense, if you watch it run, though the relative values are still I think right.<BR>
I "rewrote" the time measurement and added redundant time reporting and the numbers make more sense now.<BR>I also added a new faster method and renamed stuff for clarity.<BR><BR>
cygnothing -- just main returning 0 <BR>
cygnocyg -- same thing but with -mno-cygwin <BR>
msvcdll -- same thing but with visual c++ using msvcr80.dll <BR>
msvcstatic -- same thing but using libcmt.lib <BR>
msvcmin -- Visual C++ and no runtime, just TerminateProcess (ExitProcess is "nicer") <BR>
<BR>
spawn(nowait) + waitpid is about the same as spawn(wait), and is close to system() in inflexibility, but system() has an implicit shell wrapper and so is slow.<BR>
<BR>
It seems that spawn is faster than CreateProcess at running .exes that use cygwin1.dll. That is a little odd. It must be something to do with the child startup code talking to its parent or something and doing so more efficiently when the immediate parent uses Cygwin. I might dig into that. Like, a dynamic choice between CreateProcess and spawn could be more efficient, but so far I'm not sure even using CreateProcess here is "easy enough".<BR>
<BR>
Is there anywhere in the cm3 tree appropriate to checkin such experimental code?<BR>
I can put it in my private svn...<BR>
<BR>
Tue Mar 18 03:04:35 2008 vfork 1.163909<BR><STRONG>Tue Mar 18 03:04:52 2008 vfork/exec(sh -c ./cygnothing) 16.815984 current behavior <BR>Tue Mar 18 03:05:06 2008 spawn(nowait, sh -c ./cygnothing)/waitpid 13.296170 eliminate fork/exec<BR></STRONG>Tue Mar 18 03:05:19 2008 spawn(wait, sh -c ./cygnothing) 13.814871<BR>Tue Mar 18 03:05:37 2008 vfork/exec(sh -c ./cygnocyg) 17.898738 <BR>Tue Mar 18 03:05:51 2008 spawn(nowait, sh -c ./cygnocyg)/waitpid 13.545283<BR>Tue Mar 18 03:06:05 2008 spawn(wait, sh -c ./cygnocyg) 13.639426<BR>Tue Mar 18 03:06:24 2008 vfork/exec(sh -c ./msvcdll) 19.699897<BR>Tue Mar 18 03:06:40 2008 spawn(nowait, sh -c ./msvcdll)/waitpid 16.101528<BR>Tue Mar 18 03:06:57 2008 spawn(wait, sh -c ./msvcdll) 16.219237<BR><STRONG>Tue Mar 18 03:07:04 2008 vfork/exec(.\cygnothing) 7.816323 eliminate sh wrapper<BR>Tue Mar 18 03:07:08 2008 spawn(nowait, .\cygnothing)/waitpid 3.783029 eliminate sh and fork/exec kind of the initial goal <BR></STRONG>Tue Mar 18 03:07:12 2008 spawn(wait, .\cygnothing) 3.794715<BR>Tue Mar 18 03:07:28 2008 cygwin_system(./cygnothing) 15.840816<BR>Tue Mar 18 03:07:48 2008 msvcrt_system(.\cygnothing) 20.502232<BR><STRONG>Tue Mar 18 03:07:54 2008 CreateProcess(.\cygnothing) 5.853595 surprisingly slow <BR></STRONG>Tue Mar 18 03:08:00 2008 vfork/exec(.\cygnocyg) 6.335709<BR>Tue Mar 18 03:08:02 2008 spawn(nowait, .\cygnocyg)/waitpid 1.959032<BR>Tue Mar 18 03:08:04 2008 spawn(wait, .\cygnocyg) 1.976474<BR>Tue Mar 18 03:08:18 2008 cygwin_system(./cygnocyg) 13.295613<BR>Tue Mar 18 03:08:34 2008 msvcrt_system(.\cygnocyg) 15.849668<BR><STRONG>Tue Mar 18 03:08:35 2008 CreateProcess(.\cygnocyg) 1.541903 one of the best cases<BR></STRONG>Tue Mar 18 03:08:43 2008 vfork/exec(.\msvcdll) 8.139020<BR>Tue Mar 18 03:08:48 2008 spawn(nowait, .\msvcdll)/waitpid 4.357404<BR>Tue Mar 18 03:08:52 2008 spawn(wait, .\msvcdll) 4.378520<BR>Tue Mar 18 03:09:08 2008 cygwin_system(./msvcdll) 15.726932<BR>Tue Mar 18 03:09:26 2008 msvcrt_system(.\msvcdll) 18.211870<BR><STRONG>Tue Mar 18 03:09:30 2008 CreateProcess(.\msvcdll) 3.901068</STRONG> <BR>Tue Mar 18 03:09:36 2008 vfork/exec(.\msvcstatic) 5.783474<BR>Tue Mar 18 03:09:37 2008 spawn(nowait, .\msvcstatic)/waitpid 1.880097<BR>Tue Mar 18 03:09:39 2008 spawn(wait, .\msvcstatic) 1.915825<BR>Tue Mar 18 03:09:53 2008 cygwin_system(./msvcstatic) 13.178187<BR>Tue Mar 18 03:10:08 2008 msvcrt_system(.\msvcstatic) 15.827244<BR><STRONG>Tue Mar 18 03:10:10 2008 CreateProcess(.\msvcstatic) 1.460144</STRONG> <STRONG>one of the best</STRONG><BR>Tue Mar 18 03:10:15 2008 vfork/exec(.\msvcmin) 5.491899<BR>Tue Mar 18 03:10:17 2008 spawn(nowait, .\msvcmin)/waitpid 1.674227<BR>Tue Mar 18 03:10:19 2008 spawn(wait, .\msvcmin) 1.698951<BR>Tue Mar 18 03:10:32 2008 cygwin_system(./msvcmin) 12.980475<BR>Tue Mar 18 03:10:47 2008 msvcrt_system(.\msvcmin) 15.624337<BR><STRONG>Tue Mar 18 03:10:49 2008 CreateProcess(.\msvcmin) 1.276997 best case as expected</STRONG><BR><BR>
- Jay<BR></body>
</html>