[M3devel] possible cygwin createprocess/fork cost measurements..

Jay jayk123 at hotmail.com
Tue Mar 18 11:22:24 CET 2008


A lot of those numbers didn't make sense, if you watch it run, though the relative values are still I think right.
I "rewrote" the time measurement and added redundant time reporting and the numbers make more sense now.I also added a new faster method and renamed stuff for clarity.
  cygnothing -- just main returning 0  
  cygnocyg -- same thing but with -mno-cygwin  
  msvcdll -- same thing but with visual c++ using msvcr80.dll  
  msvcstatic -- same thing but using libcmt.lib  
  msvcmin -- Visual C++ and no runtime, just TerminateProcess (ExitProcess is "nicer") 
 
 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.
 
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".
 
Is there anywhere in the cm3 tree appropriate to checkin such experimental code?
I can put it in my private svn...
 
Tue Mar 18 03:04:35 2008 vfork 1.163909Tue Mar 18 03:04:52 2008 vfork/exec(sh -c ./cygnothing) 16.815984        current behavior Tue Mar 18 03:05:06 2008 spawn(nowait, sh -c ./cygnothing)/waitpid 13.296170 eliminate fork/execTue Mar 18 03:05:19 2008 spawn(wait, sh -c ./cygnothing) 13.814871Tue Mar 18 03:05:37 2008 vfork/exec(sh -c ./cygnocyg) 17.898738 Tue Mar 18 03:05:51 2008 spawn(nowait, sh -c ./cygnocyg)/waitpid 13.545283Tue Mar 18 03:06:05 2008 spawn(wait, sh -c ./cygnocyg) 13.639426Tue Mar 18 03:06:24 2008 vfork/exec(sh -c ./msvcdll) 19.699897Tue Mar 18 03:06:40 2008 spawn(nowait, sh -c ./msvcdll)/waitpid 16.101528Tue Mar 18 03:06:57 2008 spawn(wait, sh -c ./msvcdll) 16.219237Tue Mar 18 03:07:04 2008 vfork/exec(.\cygnothing) 7.816323 eliminate sh wrapperTue Mar 18 03:07:08 2008 spawn(nowait, .\cygnothing)/waitpid 3.783029 eliminate sh and fork/exec kind of the initial goal Tue Mar 18 03:07:12 2008 spawn(wait, .\cygnothing) 3.794715Tue Mar 18 03:07:28 2008 cygwin_system(./cygnothing) 15.840816Tue Mar 18 03:07:48 2008 msvcrt_system(.\cygnothing) 20.502232Tue Mar 18 03:07:54 2008 CreateProcess(.\cygnothing) 5.853595 surprisingly slow Tue Mar 18 03:08:00 2008 vfork/exec(.\cygnocyg) 6.335709Tue Mar 18 03:08:02 2008 spawn(nowait, .\cygnocyg)/waitpid 1.959032Tue Mar 18 03:08:04 2008 spawn(wait, .\cygnocyg) 1.976474Tue Mar 18 03:08:18 2008 cygwin_system(./cygnocyg) 13.295613Tue Mar 18 03:08:34 2008 msvcrt_system(.\cygnocyg) 15.849668Tue Mar 18 03:08:35 2008 CreateProcess(.\cygnocyg) 1.541903 one of the best casesTue Mar 18 03:08:43 2008 vfork/exec(.\msvcdll) 8.139020Tue Mar 18 03:08:48 2008 spawn(nowait, .\msvcdll)/waitpid 4.357404Tue Mar 18 03:08:52 2008 spawn(wait, .\msvcdll) 4.378520Tue Mar 18 03:09:08 2008 cygwin_system(./msvcdll) 15.726932Tue Mar 18 03:09:26 2008 msvcrt_system(.\msvcdll) 18.211870Tue Mar 18 03:09:30 2008 CreateProcess(.\msvcdll) 3.901068 Tue Mar 18 03:09:36 2008 vfork/exec(.\msvcstatic) 5.783474Tue Mar 18 03:09:37 2008 spawn(nowait, .\msvcstatic)/waitpid 1.880097Tue Mar 18 03:09:39 2008 spawn(wait, .\msvcstatic) 1.915825Tue Mar 18 03:09:53 2008 cygwin_system(./msvcstatic) 13.178187Tue Mar 18 03:10:08 2008 msvcrt_system(.\msvcstatic) 15.827244Tue Mar 18 03:10:10 2008 CreateProcess(.\msvcstatic) 1.460144 one of the bestTue Mar 18 03:10:15 2008 vfork/exec(.\msvcmin) 5.491899Tue Mar 18 03:10:17 2008 spawn(nowait, .\msvcmin)/waitpid 1.674227Tue Mar 18 03:10:19 2008 spawn(wait, .\msvcmin) 1.698951Tue Mar 18 03:10:32 2008 cygwin_system(./msvcmin) 12.980475Tue Mar 18 03:10:47 2008 msvcrt_system(.\msvcmin) 15.624337Tue Mar 18 03:10:49 2008 CreateProcess(.\msvcmin) 1.276997 best case as expected
 - Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20080318/b8151fff/attachment-0002.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygexec.c
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20080318/b8151fff/attachment-0002.c>


More information about the M3devel mailing list