-
-
Notifications
You must be signed in to change notification settings - Fork 141
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
feature: splat init checks for pre registrations #360
Conversation
checks to see if a resolver already has registrations for types we're interested in
Codecov Report
@@ Coverage Diff @@
## master #360 +/- ##
=========================================
Coverage ? 71.33%
=========================================
Files ? 66
Lines ? 3663
Branches ? 333
=========================================
Hits ? 2613
Misses ? 1004
Partials ? 46
Continue to review full report at Codecov.
|
I been slowly merging everything over to valuetuple format over tuple. Usually has greater self documentation also performance advantages. |
This is a good overview and how to use the new value tuple shorthand https://blogs.msdn.microsoft.com/mazhou/2017/05/26/c-7-series-part-1-value-tuples/
|
I just did a benchmark of using the ValueTuple directly vs GetKey()
My test was simple
Number of test cases was 10,000 That's with randomly allocated keys etc. So that confirms the way you are doing it is fractionally slower if anything meaningful. |
Also just did this for curiosity, added the following benchmark [Benchmark]
public void TestWithTupleGet()
{
for (int i = 0; i < NumberCases; ++i)
{
var key = Tuple.Create(ElementsNames1[i], ElementsNames2[i]);
var element = _indexToTupleElements[key];
outputElements.Add(element);
}
}
|
With and Without both inside the margin for error? And the result reversed 2nd time around. I can decorate with MethodImplOptions.AggressiveInlining? (if it's not already inlining?) or put it back. I've no preference :) |
The error increased on the second run. Which means my computer was probably under greater strain at the time. |
I think that shows how little margin is in it that the Get() approach is fine, but getting rid of Tuple is validated. |
Might as well bump the minor version by one by incrementing the second number in version.json in the root directory for this one. |
be nice if the todo comments were done as closable review, deleted them for clarity on this PR |
got much left to do on this one @dpvreony ? |
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Resolves #331
I've changed the splat init logic to check if the resolver it is being hooked up to has already got registrations to types we're interested in (LogManager, Logger, BitmapLoader)
What is the current behavior? (You can also link to an open issue here)
depending on the nuance of the container involved. logging would be overridden or appended with no guaranteed order of retrieval.
What is the new behavior (if this is a feature change)?
tried to apply some consistency between dryioc and moderndependencyresolver. developers still have control within dryioc etc to get undesired behaviour. added documentation to that effect.
What might this PR break?
I've added a HasRegistration method call to the Mutable Resolver interface
Please check if the PR fulfills these requirements
Other information: