process - Any better alternative to fork() and then execvp(" gcc program.c ")? -


The following code segment takes a long time (5s) when it is run for the first time and continuously running short time (250ms ) Gets applied . There is no better way to execute the GCC.

  int pid, status; Four * argv [] = {"gcc", "program.c", NULL}; If (! (Pid = fork ())) {execvp ("GCC", argv); } While (pid! = Wait (& amp; condition)) {// nothing}  

Well, I do not think so. The first time on 5 seconds is probably the time to read the memory of the disc from the compiler itself, to compile the formula, to include headers, to link against the libraries etc. It's all scattered throughout the disk, so the head of the disk will have to do a lot, it is slow.

After that, you have all the data cached in the RAM, it is just parsing and compiling and maybe the CPU becomes the Bodon instead of the IPO bound.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -