Closed xumix closed 11 months ago
Attributed metadata does have a perf impact, which is why it's all very much opt-in / pay-for-play. In fact, it's so opt in that you didn't even file this in the right repo - Autofac.Extras.AtributeMetadata has its own repo and issues list.
If you don't want the perf hit, don't use attribute metadata.
If you want better perf, we'd love to see a PR in that repository to help optimize.
Describe the Bug
It looks like
AttributedMetadataModule.AttachToComponentRegistration
is getting called for each resolution, therefore causing some unpleasant effects. I've attached screenshot of our application tracing and highlighted the offending lines (the time is cumulative). Our custom modules are also highlighted for comparison.Steps to Reproduce
Expected Behavior
Metadata is added once per registration, then used during resolve
Exception with Stack Trace
Dependency Versions
Autofac: 6.3.0