This PR removes unnecessary allocations of Lazy/Func instances by using a valueFactory instead of a value when using GetOrAdd method on concurrent dictionary.
Allocations before (48 Mb):
Allocations after (40 Mb):
To Profile I used Profiler project using the following code
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
Fixture fixture = new Fixture();
var data = fixture
.Build<User>()
.With(u => u.Offerings, fixture.CreateMany<Offering>(50).ToList)
.CreateMany(1000).ToArray();
var serialized = AvroConvert.Serialize(data);
}
}
This PR removes unnecessary allocations of Lazy/Func instances by using a
valueFactory
instead of avalue
when usingGetOrAdd
method on concurrent dictionary.Allocations before (48 Mb):
Allocations after (40 Mb):
To Profile I used
Profiler
project using the following code