I have a four-level data structure defined as follows:
Dictionary<Type1, Dictionary<Type2, Dictionary<Type3, List<Type4>>>>
All of this is encapsulated in a class that also supports thread safety. Currently, it just blocks the whole collection when it reads / processes data (reading is an order of magnitude larger than writing).
I was thinking of replacing Dictionarywith ConcurrentDictionaryand Listwith ConcurrentBag(its elements do not need to be ordered).
Dictionary
ConcurrentDictionary
List
ConcurrentBag
If I do this, can I just remove the locks and make sure that parallel collections will do their job correctly?
, . , , :
, . , GetEnumerator.
, , , ReaderWriterLockSlim, , .
.. , - , :
Dictionary<Tuple<Type1, Type2, Type3>, List<Type4>> ?
Dictionary<Tuple<Type1, Type2, Type3>, List<Type4>>
, - ( ) O (1) ( , ConcurrentDictionary), , . ConcurrentDictionary.
, Type2 Type1, , , . ?
Type2
Type1
Source: https://habr.com/ru/post/1790921/More articles:Why does the DropDownList.SelectedIndexChanged event not fire? - javascriptBlock incoming / outgoing SMS on Android - androidDoes iOS 4.2 SDK support custom fonts? - iphoneЛюбой встроенный метод знать только в том случае, если два списка отличаются друг от друга? - comparisonWhat is the difference between managed and unmanaged dlls - dllHQL JoinTable Not Available - hibernateAndroid Facebook SDK - problem with authorizeCallback () - androidCan you force SQLCMD to immediately run each statement in a script without using "GO"? - sql-serverhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1790925/flash-101-as3-applying-realtime-effects-to-microphone-stutter-problems&usg=ALkJrhiIPT5Uavl9orNNYsO6goo1IhnCBwHow can I get the name of my windows service at runtime? - c #All Articles