Max Shifrin
Max Shifrin

Reputation: 809

Reducing Boost Python Compilation Time

I have a very large scale interface that I expose via boost-python, roughly 100 objects with roughly 30 functions each.

Additionally there are enum definitions (about 1 per class on average) And about 5 sub classes for each class, with roughly 5 functions each.

This does seem like a lot of code. (the file is about 9K lines of codes before unwrapping the boost macros)

So this takes about 3-4 minutes to compile/link on a single CPU. Is there a reasonable way to improve the compilation time, by an order of magnitude for example?

Anything I should not do within boost-python which affect the compile time?

One solution I thought of is distributing the API across several files but that does not really help, because other things already compile in parallel to my API, so overall this won't reduce the total compilation time, even increase it. (My API lib is not a blocker to other processes)

Upvotes: 1

Views: 359

Answers (1)

doqtor
doqtor

Reputation: 8494

I'd give distributing over multiple files a try though.

You will reduce the memory consumption which may contribute towards the slowness plus next time you build you will compile only the modified files thus significantly reducing the compilation time during development.

Details here.

Upvotes: 1

Related Questions