Waf on jython 2.5 - conclusion
After discarding many possible causes (threading, garbage collection), the problem has finally been located in the Jython subprocess execution
Since os.fork might allocate too much memory, Jython uses ProcessBuilder for executing external programs (new in Java 1.5).
Update: Java itself does not seem to be slow at launching processes:
~/tmp/pb > javac Fu.java
~/tmp/pb > time java Fu
1.63user 3.87system 0:05.89elapsed 93%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+64outputs (1major+567624minor)pagefaults 0swaps
The code of Fu.java is the following:
import java.io.*;
import java.util.*;
public class Fu {
public static void main(String args[]) throws IOException {
for (int i = 0; i < 1000; ++i) {
ProcessBuilder p = new ProcessBuilder("ls", "-l", "/tmp");
p.start();
}
}
}