Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
How hashset memory overhead depends on objects size? And what if objects have different size?
The size of the HashSet is going to be related to the size of a variable of the type of objects that the HashSet holds. So for all reference types, that's the size of a reference, regardless of which type it is.
And what if objects have different size?
A HashSet can only store objects of one type, so they can't have a different size. They must all be the same size.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
So I am making an inventory system and I have a choice to make inventory through lists and arrays. Which approach is better and why in C#? This inventory system is for a 2d Platformer in unity.
In .Net, a list is a wrap of an array. It has similar performance, but List has built-in methods to resize the array, which contains all entries of the list. If your arrays are never resized, not need to use List.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I need to use square matrix of size between 100x100 and 1000x1000.
I only need to read the matrix, modify some values and copy the matrix (many many times!)
It's more efficent to use the rectangular form, like int[][], or the multidimensional form, like int[,] ?
Or there is a better way or a better class to use?
There are two factors involving when deciding between arrays, Memory and performance. The Multi dimensional array has a good memory management than the jagged array, which is array of arrays. In case of performance, the jagged array is the fastest may be due to poor implementation of CLR. so clearly when you have a matrix form which requires multiple traversals, its better to use jagged arrays though it has some memory hit.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Someone can explain how Collections.Concurrent library are work ?
How we get the thread-safe ?
Is their performance are good ?
You can inspect the concurrent collections implementation by yourself here (this is for ConcurrentDictionary<TKey,TValue>, other collections you can find using the left navigation pane) and get the exact picture of how they work.
The implementation depends on the collection type. It uses volatile, SpinWait, Interlocked and lock.
More information about performance is available in this paper.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Is a List in C# equal to that of an ArrayList in terms of time complexity?
As it is my understanding that they're both similar in how they function, being dynamic arrays?
Both ArrayList and List<T> have the same basic implementation, using an array to store the items, reallocating as necessary when items are added. Indeed, much of List<T> is simply copy/paste from ArrayList, with appropriate changes to support the generics.
While there may be small differences in actual performance, the "big-O" complexity of operations in each would be the same.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Wondering if I can create a heater/ coin miner combo that only turns on when the heater in my house is also on.
Is that possible? What are the limitations of this type of concept?
The best thing is to leave the fan blowing, while you don't need the temparature in the processor, but in the room. Therefore the fan needs to blow it into your room. Not to say that your processor needs cooling in order to maintain a reasonable life time.
As an collatoral benèfit the fans consumes power, and thus generates also (a little) heat.