-
Notifications
You must be signed in to change notification settings - Fork 65
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
.net Core and performance increase #15
Comments
Good idea for .Net Core, especially if it's "free" :) If you already know how to enable .Net Core in NuGet packaging and in the build, please feel free to do a pull request for a quicker update ;) As for the ConcurrentDictionary, it is not thread-safe (we cache the mapping once). It might be cheaper to re-create the dictionary every time however, it would be worth doing some tests. Again, if you want to do a PR for this, I'd like to see some numbers :) But the dictionary cannot be static if we do that. |
Unfortunately, I never played with nuget before, so I don't know how to update it. :( For the dictionary, correct me if I'm wrong, but we're just reading it (except, of course, in the initialization), so, it should be thread safe: https://msdn.microsoft.com/en-us/library/xfhwa508(v=vs.110).aspx
|
You may be right. The original code actually did create itself at runtime, and I believe we could indeed bring back a normal dictionary since it's initialized by the JIT (because it's statically initialized, it is guaranteed to be thread-safe). So, both of your requests are totally valid :) |
I did some quick tests:
Seems like performances are pretty much the same. I'll probably push this anyway... later :) If you feel like looking into the .Net Core stuff, that'd be nice :) |
Converted to .net Standard 1.0 (https://docs.microsoft.com/en-us/dotnet/standard/net-standard). Unit tests run successfully, but I can't help with the build script (pretty sure that will never work on Linux and MacOS). As far I researched, nuget package doesn't need anything special (only a .net Portable Library (deprecated) or a .net Standard project (.net Core compliant)). |
The code is .net core 1.1 compatible, please, update the nuget =)
And why using ConcurrentDictionary<K,V> on a single thread environment? It is WAY slower then the default Dictionary<K, V>: https://stackoverflow.com/questions/15252115/concurrentdictionary-performance-at-a-single-thread-misunderstanding
The text was updated successfully, but these errors were encountered: