Comments (2)
Good catch! If I understand this issue correct, defensive copies are made during use (access properties etc), while by removing the in parameter a copy is also made. Can we avoid these issues by using ref
instead of in
on the wrapper? I think I should make some benchmarks for this to see exactly what the behavior is here. I tried to see the codegen difference for this in sharplab a while ago but was unable to produce the difference. I might be misunderstanding something here..
from mediator.
Yes you can use ref, but it should not be necessary.
The jit is smart enough by now, see
https://sharplab.io/#v2:EYLgxg9gTgpgtADwGwBYA0AXEBDAzgWwB8ABAJgEYBYAKGIAYACY8gOgCUBXAOwwEt8YLAMIR8AB14AbGFADKMgG68wMXAG4aNYgGYmpBkIYBvGgzMNY2ACYQukgJ4NcGKBzAYGAEWwZsx0+aBOhYw1rYODLw8DAhoDPZxAF5xAO4a1IGBANoAsjAYABYQVgCS4pIAFHmFxWVikgDyYny2uCwAchAldlFRAOYAlAC6AZlMupY2do7EKAwAQthQFQPGDAC+oxtbW8xITHMAKqoY5BXevgxWqyYZY5EAZgwVViwIDAB8DHSrr4vLA3SgU2dzMewODGOzlIFSiXh8fmu/lBmV4Txeb0+31+LH+KyB5hB6yAA===
The asm for both methods, with and without in, is the same for a read-only struct. Even if the struct is only defacto read-only, by making all fields and methods read-only it's smart enough.
That's why I said in the PR that we can let the jit decide.
from mediator.
Related Issues (20)
- AddMediator(config => ..) not working HOT 4
- Run NotificationHandlers in parallel HOT 17
- Usage without dependency injection HOT 2
- Support for internal objects that implement IRequest. HOT 2
- SQL Transactions with a pipeline HOT 1
- Is it possible to get a Courier design similar to another library in Mediatr HOT 2
- Suggestion: Consider moving the analyzing to a dedicated analyzer HOT 2
- Multilayered app problem HOT 6
- Generator 'IncrementalMediatorGenerator' failed to initialize under .net 8 (8.0.0.100) and Sonoma 14.1 HOT 1
- DefaultServiceLifetime.Transient registers Mediator as transient too as opposed to ReadMe HOT 7
- Proposal: Mediator 3.0 design to support multiple configuration and fast switching. HOT 1
- Empty Handler needed in order to work with behavoiur pipeline HOT 2
- Sample projects don't work in isolation HOT 3
- different Request/Command/Query HOT 2
- Native AOT HOT 2
- Mediator.MissingMessageHandlerException Help
- Incorrect switch case order in polymorphic notifications HOT 3
- Issue on Project with Mediator and MassTransit HOT 1
- Support generic handlers HOT 3
- Move Interfaces to Mediatr Contracts Package.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mediator.