2
Vote

Performance issue caused by scanning for exported members

description

We have a performance issue with the composition of types from assemblies which have many types, each of them having many members. We never(!) use the [Export] attributes on members. We only use the [Export] attributes on (few) types. We would like to have an option to turn off discovery of exports from members (field, properties, methods) entirely.

This could be implemented by making the BindingFlags used for reflection of members configurable and skip/ignore all members if they are set to BindingFlags.Default (0).

Some performance numbers:
We have 19 exports in 13 assemblies with a total of 3,093 types/46.459 members => the first composition takes approx. 3.200(!) ms.
When we ignore the members, it only takes 14(!) ms.

comments