Skip to content

Compilation performance benchmark (boost::di vs kangaru) #79

@Dragnalith

Description

@Dragnalith

I am investigation compilation performance, and I have discovered boost::di was way faster than kangaru.
Both have a compile time "autowire" feature. The following table compare boost::di with kangaru with and without autowire. I have generated a class graph and services are all kgr::single_service services.

Class Count Kangaru (autowire) Kangaru (dep) Boost::di
4 1.56s 1.23s 0.4s
11 3.27s 1.65s 0.74s
26 7.41s 2.26s 1.22s
57 19.93s 3.81s 2.11s
120 compiler is out of heap space 7.17s 4.13s

We can see Kangaru (autowire) seems to have an exponential complexity where for Boost::di it looks linear. This difference is surprising because even without autowire boost::di is faster. I am also surprise I cannot compile a graph with more than 100 classes.

I wonder which template black bagic makes this kind of performance difference. If we find it we could use it for kangaru's autowire.

You can find my test bench it this repository: https://github.com/Dragnalith/di_experiment. The dependency of this gen_test.h matched the 57 class count row.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions