I'm new to .NET programming. Sorry if this question has been asked earlier.
I am currently learning F #. What is the difference between dictionary, hashtable and map? When should I use each?
I have another question that is not mentioned in the title. When should i use async.RunSynchronously? It seems self-contradictory to me, so I'm sure I'm missing something.
The choice between the dictionary, depends on cases of hashtable and map usage. Although you should know the characteristics of each, it is not a complete list, but some important differences you want to start with:
- hashtable those key / value pairs Is a collection of which is the hash code of the key. It is an unqualified collection from NAT BCL.
- Dictionary
- Education The F # is immutable types. It is implemented on the basis of AVL trees which have completely separate data structure with different performance characteristics and use cases.
If you write several, then display a better filling rate better in the hash table collection AVL tree.
Using a key is very fast to get one value from a dictionary, is close to O (1) , because the dictionary class is implemented as a hash table goes. / P>
The F # map is implemented as a temporary AVL tree, an efficient data structure that makes itself a binary tree of balance. AVL trees are famous for their efficiency, in which they can search, insert and remove elements in the tree at the time of O (log n) , where n is the number of elements in the tree.
As you use the case for the map, if you have found a set of static data (such as the configuration data that loads when your application starts) you will often see the key It is necessary, as a map, good choice in any form, its inconsistency in this case ensures that static data can not be accidentally modified and its performance is small Impact because you never need it to get started.
Async.RunSynchronously runs
asynchronous calculation provided and its result is waiting. You can use it in the F # interactive window, for example test your asynchronous workflow.
No comments:
Post a Comment