I have a large table of words need to process.
Since it needs to handle massive call. I want this process can run as fast as possible.
What I've tried:
declaring
const char* WORDS[10000] = {new const char{12, 23 ...};
and match the document one by one from 0 to end.
so if a document has size of 20000.
It loop each index and start matching from WORDS from 0 to 10000.
Then it loop to match if each char is equal.
That would made a 20000*10000*sizeof(WORDS[m]) loop .
I tested and it is very slow(approximately takes about several secs)
So I wonder, if I make it like this:
1 2 3 4 5 6 7 8 9 10 11
|
void match_p(char const* str, int start, char const* &out, int &out_size)
{
// matching each using if statement
if(str[start] == 65 && str[start + 1] == 65)
{
out = "AAAA";
out_size = 4;
}
else if(...
// I could use some macro to generate this code
}
|
Would this be the fastest way to do so?
PS: Since I am still a beginner, I didn't do much approach since I am getting so many syntax error while coding. I decided to ask for the best way to do so than I can start digging in to the code, thanks:)