Moderator
Staff member
Moderator
- Joined
- Feb 22, 2008
- Messages
- 2,427
- Reaction score
- 757
I have a Dictionary<int,byte[]> with 191k elements. I also have a buffer (byte[] aswell) that I get by using File.ReadAllBytes (the file has aprox. 4mb).
The problem:
I have to search the entire 4mb buffer for the given Key in the dictionary, something like:
Locate being a function that searches the entire buffer for the given byte[] pattern.
But the searching is taking too long, I waited more than 2 minutes and it is still not even in the half progress...
What could I do to speed up the process?
The problem:
I have to search the entire 4mb buffer for the given Key in the dictionary, something like:
Code:
foreach(var element in dic)
{
var timesFound = buffer.Locate(element.Key);
}
Locate being a function that searches the entire buffer for the given byte[] pattern.
But the searching is taking too long, I waited more than 2 minutes and it is still not even in the half progress...
What could I do to speed up the process?

