I want to make a dictionary the key type of which is string
and the type of values is list
. I think I could make one like this:
static Dictionary<string, List<String>> dic_list = new Dictionary<string, List<String>>();
There will be a lot of append(Add) calls to each list(more than a million per list and there are dozens of lists). I don't know exactly how many strings will be added, but I know their size (200 bytes per each). I wonder if knowing the size can be advantageous to the performance. Is it better to set a dictionary this way in this scenario?:
static Dictionary<string, List<String>> dic_list = new Dictionary<string, List<String>>(200);
I'd appreciate it if you could share any ways to optimize this kind of jobs.
I referred to this thread: Performance of Arrays vs. Lists