Portage is shit slow. If it wasn't clear to you that it should have been written in plain C from the beginning, then I suggest you now to rewrite it into C now. I write programs in C and they are always lightning fast. So rewrite into C will definitely fix the problem.
Reopen with a C rewrite of portage. Thanks.