-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Frozen collection construction performance #87964
Comments
Tagging subscribers to this area: @dotnet/area-system-collections Issue DetailsFrom @stephentoub in #77891
public static FrozenSet<T> ToFrozenSet<T>(this IEnumerable<T> source, IEqualityComparer<T>? comparer = null,
+ double constructionOptimization = default // pick a better name
);
|
I've written a lot of new benchmarks to cover the most important strategies: dotnet/performance#3089 And send five PRs that improve the creation time: #87510 (already merged) Creating frozen dictionaries (and sets) optimized for reading where keys are strings or integers is now from 39% to 94% (16 times!) faster. In all cases except of one, it's few times faster than the creation of immutable dictionary. BenchmarkDotNet=v0.13.2.2052-nightly, OS=Windows 11 (10.0.22621.1848)
AMD Ryzen Threadripper PRO 3945WX 12-Cores, 1 CPU, 24 logical and 12 physical cores
.NET SDK=8.0.100-preview.4.23259.14
[Host] : .NET 8.0.0 (8.0.23.25905), X64 RyuJIT AVX2
all : .NET 8.0.0 (42.42.42.42424), X64 RyuJIT AVX2
before : .NET 8.0.0 (42.42.42.42424), X64 RyuJIT AVX2
LaunchCount=9 MaxIterationCount=20 MemoryRandomization=True
10 strings100 strings1000 strings10000 strings |
Cc @geeknoid |
AFAIR, we've more recently rejected using Using an integer from 0-100 would be significantly clearer. Having some other value or type to represent the information may likewise be better itself. -- Half of all representable positive doubles are between |
Adam copied this text out of an old issue. It's stale. We long ago decided to add this instead as a bool optimizeForReading, which we did in a previous preview release, and with all the improvements Adam has made, I intend to remove those overloads and not differentiate. |
From @stephentoub in #77891
public static FrozenSet<T> ToFrozenSet<T>(this IEnumerable<T> source, IEqualityComparer<T>? comparer = null, + double constructionOptimization = default // pick a better name );
The text was updated successfully, but these errors were encountered: