-
Notifications
You must be signed in to change notification settings - Fork 344
Conversation
src/Microsoft.Experimental.Collections/Microsoft/Collections/Extensions/RefDictionary.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Experimental.Collections/Microsoft/Collections/Extensions/RefDictionary.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Experimental.Collections/Microsoft/Collections/Extensions/RefDictionary.cs
Outdated
Show resolved
Hide resolved
...rosoft.Experimental.Collections.Tests/Microsoft/Collections/Extensions/RefDictionaryTests.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Experimental.Collections/Microsoft/Collections/Extensions/RefDictionary.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Experimental.Collections/Microsoft/Collections/Extensions/RefDictionary.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Experimental.Collections/Microsoft/Collections/Extensions/RefDictionary.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Experimental.Collections/Microsoft/Collections/Extensions/RefDictionary.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Experimental.Collections/Microsoft/Collections/Extensions/RefDictionary.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Experimental.Collections/Microsoft/Collections/Extensions/RefDictionary.cs
Outdated
Show resolved
Hide resolved
tests/Benchmarks/Microsoft.Experimental.Collections/RefDictionaryPerformanceTests.cs
Outdated
Show resolved
Hide resolved
tests/Benchmarks/Microsoft.Experimental.Collections/RefDictionaryPerformanceTests.cs
Outdated
Show resolved
Hide resolved
tests/Benchmarks/Microsoft.Experimental.Collections/RefDictionaryPerformanceTests.cs
Outdated
Show resolved
Hide resolved
...rosoft.Experimental.Collections.Tests/Microsoft/Collections/Extensions/RefDictionaryTests.cs
Outdated
Show resolved
Hide resolved
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.
Where is the speclet issue related to this PR?
src/Microsoft.Experimental.Collections/Microsoft/Collections/Extensions/RefDictionary.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Experimental.Collections/Microsoft/Collections/Extensions/RefDictionary.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Experimental.Collections/Microsoft/Collections/Extensions/RefDictionary.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Experimental.Collections/Microsoft/Collections/Extensions/RefDictionary.cs
Outdated
Show resolved
Hide resolved
BenchmarkDotNet=v0.11.1, OS=Windows 10.0.17134.285 (1803/April2018Update/Redstone4) RefDictionaryGeneral:
RefDictionaryKNucleotide:
Note: 25_000_000 shows even better perf but takes ages RefDictionaryGroupBy:
@ahsonkhan @TylerBrinkley @safern @danmosemsft We should discuss next steps. I'm just going to look at improving the other methods like Keys/Values and see if I can use Span anywhere until then. Note: updated after resize improvements. |
Whoa!! |
Can't wait to get numbers on the Q6600 |
@AnthonyLloyd, interesting! How about adding comparer as type parameter? public sealed class RefDictionary<TKey, TValue,
TEq> : IReadOnlyCollection<KeyValuePair<TKey, TValue>> // almost IReadOnlyDictionary<TKey, TValue>
where TEq : struct, IEqualityComparer<TKey>
{
private static readonly TEq _comparer = default;
// etc. |
@dadhi Thanks, I tried it but not quite as good as
|
src/Microsoft.Experimental.Collections/Microsoft/Collections/Extensions/RefDictionary.cs
Outdated
Show resolved
Hide resolved
For GetOrAddValueRef, I did not include the value as a parameter. I think that's potentially confusing/adds overhead. Also I didn't add the "normal" indexer as we don't have a scenario currently. I think all feedback is now addressed? |
@AnthonyLloyd @TylerBrinkley do changes look good? I would like to merge .. |
Looks good to me. |
Q6600 with e536592 still fine.
|
Squashed, backup of history at https://github.com/dotnet/corefxlab/compare/master...danmosemsft:slimdictionary.history.backup?expand=1 |
Thanks @AnthonyLloyd @mikedn and @TylerBrinkley We got a nice result, looking forward to getting it on nuget for feedback, and in the benchmark game. |
Thanks @danmosemsft. I really appreciated the opportunity of providing input on this! |
@AnthonyLloyd we've published the latest NuGet package into nuget.org so that it can be used for the benchmarks 😄 https://www.nuget.org/packages/Microsoft.Experimental.Collections/1.0.6-e190117-3 |
@safern great thanks, I've now submitted k-nucleotide to BenchmarksGame with it. |
@AnthonyLloyd interesting, I see they posted it, and it's a bit slower than the Hack9 one. My measurements above, on the exact same hardware as them, got 9% faster. Any idea about that? I was going to suggest we put an F# one up too, but it would be good to figure out what's wrong here first. One thing I notice is that the CPU utilization of the new one is a bit lower than the old one. That may be spurious though and I remember I did try various reorderings of the tasks and none were better than the existing one (I put those notes in one of the issues/PR's, can't find it right now) |
I'm not sure. There are start up costs that we don't model. In the Benchmarks Game they run it 5 times and take the best result. It may be a bit random. I've seen this before where I knew something was faster but it didn't show up. |
Yeah, I'm interested on what the effects of Tiering will be (e.g. 2.1 v 3.0) as they should get rid of some of the startup costs; but may introduce unoptimization + recompilation costs; so will be interesting how they play out in these benchmarks |
An extra DLL load.. |
@AnthonyLloyd is it worth asking for suggestions in the F# repo? I doubt they will be satisfied with being slower than C# |
@danmosemsft @AnthonyLloyd @benaadams I initiate DictionarySlim this way, in case if it matters: Then I just before execute console command, check whether it exists/registered in _commandMap and get the crash above, because at the moment of such check _commandMap is empty yet. Also, the same error I getting when trying to add command first: https://i.imgur.com/Y8BkGrz.png
I do it wrong way? P.S. Using .NET Core 2.2 & VS2019. |
@Krakean could you please open a new issue? It looks like you are consuming DictionarySlim as source, not via the nuget package. And your binary Nuage.Engine.dll is compiled with checked arithmetic, which is not the default. Without checked, the comparison would fail and the method simply return false. We could explicitly put BTW in general it is best to not append to closed issues/PR's as the comment may not be seen. |
@danmosemsft
Yep. I prefer to not bring packages when I need just one file :)
Yes, it is. Because, well, arithmetic overflows are no good, no? :)
Well, if it can fix it, then why not.
PR - unlikely, but open an issue - yes :) |
A community member began an effort a while back to change all of CoreFX (the .NET Core libraries) to build with checked arithmetic, marking unchecked as necessary (for cases like this). We abandoned the effort as it was making the code uglier without finding significant actual bugs. I think it is fine to mark this case if it helps you though. |
Note that |
No description provided.