I don't know how long your 1,000,000 or 20,000 long loops take, but if you're forking 20 billion times, I bet it's going to be slower. If you can divide your 20 billion loops into some smaller number and only fork that many times (and do more work in each loop), then maybe you can get some benefit from forking.