Allocation is cheap in .NET until it is not
tooslowexception.com
Allocation is cheap in .NET until it is not
1–10 of 67 posts
Re: Allocation is cheap in .NET until it is not
#2Re: Allocation is cheap in .NET until it is not
#3Re: Allocation is cheap in .NET until it is not
#4This brought memories of that pattern (flyweight?) where the data was stored outside the objects, possibly in an array. An object was instantiated only to hold an index to the array position and allow access. That's dirty cheap!
Re: Allocation is cheap in .NET until it is not
#5This brought memories of that pattern (flyweight?) where the data was stored outside the objects, possibly in an array. An object was instantiated only to hold an index to the array position and allow access. That's dirty cheap!
With the latest C# 7.x features will become easier to use it.
Re: Allocation is cheap in .NET until it is not
#6This brought memories of that pattern (flyweight?) where the data was stored outside the objects, possibly in an array. An object was instantiated only to hold an index to the array position and allow access. That's dirty cheap!
It's still commonly used. The NFX library has Pile which does this well for holding large data: http://nfxlib.com/book/caching/pile.html https://www.infoq.com/articles/Big-Memory-Part-1
Re: Allocation is cheap in .NET until it is not
#7This brought memories of that pattern (flyweight?) where the data was stored outside the objects, possibly in an array. An object was instantiated only to hold an index to the array position and allow access. That's dirty cheap!
Re: Allocation is cheap in .NET until it is not
#8This brought memories of that pattern (flyweight?) where the data was stored outside the objects, possibly in an array. An object was instantiated only to hold an index to the array position and allow access. That's dirty cheap!
Re: Allocation is cheap in .NET until it is not
#9Re: Allocation is cheap in .NET until it is not
#10Earlier quoted context omitted.
It's still commonly used. The NFX library has Pile which does this well for holding large data: http://nfxlib.com/book/caching/pile.html https://www.infoq.com/articles/Big-Memory-Part-1
This pattern was also used by Java and .NET for implementing cheap String.substring calls where all substrings would use the same underlying array with just offsets changed. Unfortunately it turns out that people read entire files into a one big String and then have a reference to just a small piece of it (via substring) marking the big underlying array as reachable for the GC holding a lot of memory for no reason. T…