-
-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use ForAttributeWithMetadataName
#327
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #327 +/- ##
==========================================
+ Coverage 91.71% 91.94% +0.22%
==========================================
Files 109 118 +9
Lines 3379 3710 +331
Branches 438 501 +63
==========================================
+ Hits 3099 3411 +312
- Misses 189 205 +16
- Partials 91 94 +3
... and 4 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Seems like the pipeline can't find |
This depends on the Roslyn version which is used to run the source generator. AFAIK this depends whether the source generator runs in Visual Sutdio (which uses the Roslyn version which is shipped with VS), via cli (which uses the Roslyn version bundled by de sdk in use), or via other tools. Mapperly already multi targets Roslyn 4.0, 4.4 and 4.5 and provides a constant |
Makes sense forgot about that 😆
I'd hoped this was a quick small change so hadn't given this much thought (haven't benchmarked a SG before). This PR claims that roslyn may do up to x40 times less work with this change. The PR did raise some concerns, although I'm not sure if they apply here. I'm not familiar with source generators so I can't say how beneficial this change would be, I've updated this PR to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to accept this change 👍
The biggest performance improvement could be achieved by implementing a "real" incremental source generator, as the current implementation is not really incremental (tracked in #72). I started working in that quite some time ago, but didn't find the time to complete it.
Do you use Mapperly in a project where Mapperly becomes a performance bottleneck?
My knowledge of roslyn and source generators are limited to partially rewriting codemaid and reading these articles. I'm not sure if its possible to do memoisation when passing You could move the distinct call from var distincted = mapperClassDeclarations.Collect().Select((myObjects, _) => myObjects.Distinct().ToImmutableArray());
var compilationAndMappers = context.CompilationProvider.Combine(distincted);
Only in a small personal project, so I wouldn't be aware of issues if they existed. Do you use mapperly at scale at riok? |
To address #72 I think the compilation needs to get out of the pipeline as soon as possible, as it changes each time and therefore disables caching. But Mapperly for example uses |
For what it's wortht the I did think that most of the logic could be removed from |
73d82e7
to
f6058a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO the filenames of the newly added files could be improved. Suggestions: SyntaxProvider.cs
(this file may not be needed anymore...), SyntaxProvider.Roslyn4.0.cs
and SyntaxProvider.Roslyn4.4.cs
(Mapperly already uses similar naming conventions (eg. Riok.Mapperly.Roslyn4.0.props
).
b597dff
to
f13c103
Compare
Thanks for the help, I'll rebase when the tests pass. |
f13c103
to
6161e3b
Compare
00db61a
to
ad36d3c
Compare
ad36d3c
to
7b02c4f
Compare
🎉 This PR is included in version 2.8.0-next.2 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
ForAttributeWithMetadataName
was added to target types with attached attributes. Should have a performance boost - (not familiar with source generators).