VanitySearch.cpp:94.
I'm a bit surprise of your performance using -c.
yeah me too i have to try with less "-" options to narrow down where that performace hit comes from..
you mean Vanity.cpp:94, yeah i see that now but the pre-build list is not complete right?:
the original question arose because my 11prefix list goes from 6 digits to 16 digits and the programm said 11 prefixes and a list of 38 combinations.. the real number of combinations should be in the thousands since every digit that is not "0O1l" should open a new **2 combination of case-insensitive variants 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 just for a 10 digit prefix ..... 65536 for a 16 digit prefix if there is no 0O1l in there..
Vanity.cpp:546
void VanitySearch::enumCaseUnsentivePrefix(std::string s, std::vector<std::string> &list)
in metatalk:
first for loop lowers, copys and saves position of all char in prefix
second for loop iterates over length with every position (using the third for loop) and push_back result
third for loop uppers all corresponding char or leaves them in lower .. in all combinations
but the third for loop doeas NOT exactly do that.. i think..
Vanity.cpp:570
int mask = 1 << j;
the bitshift is clever but it iterates 1, 2, 4, 8 .... for mask
that combined with
Vanity.cpp:571-572
if (mask&i) tmp[letterpos[j]] = toupper(letter[j]);
else tmp[letterpos[j]] = letter[j];
where " mask AND i " the binary addition with i iterating 0, 1, 2, 3, ...
leaves out a few combinations if i'm not mistaken (only by looking.. i don't have a compiler at the readdy for that right now, for testing, i'm not home)
1AB puts out a list of 4 combinations .. thats correct but
at the moment the prefix 1ABC puts out a list of 6 combinations where it shound be 8:
1ABC
1abc
1Abc
1aBc
1abC
1ABc
1AbC
1aBC
if u run a copy of enumCaseUnsentivePrefix where you upper in the first for loop and lower in the third for loop it should cover the char position 3 and work up to 4 char but that's it..
imlementing a recursion here is the best way i feel where you could replace the second and third for loop with something resembling:
void VanitySearch::recPrefixBuild(std::string s, std::vector<std::string> &list) {
...
for ... // find first changable char position
recPrefixBuild(firstStringPart + tolower( s[changableCharPosition] ) + lastStringPart, &list) // lower and recurse
recPrefixBuild(firstStringPart + toupper( s[changableCharPosition] ) + lastStringPart, &list) // upper and recurse
}
since u call enumCaseUnsentivePrefix for every prefix seperatly it shound not eat up memory because the recursion collapses before a new prefix is called with enumCaseUnsentivePrefix. (Vanity.cpp:87 and Vanity.cpp:97)
of coure you could also brute force the recursion like:
void VanitySearch::recPrefixBuild(std::string s, std::vector<std::string> &list) {
...
cut of CHAR 1 s[0] and if rest of s != NILL call recPrefixBuild(s[1..(length(s)-1), &dummyList]
copy tolower(s[0]) in front of every dummylist entry into lowerList
copy toupper(s[0]) in front of every dummylist entry into upperList
return lowerList + upperList // push_back in list of course..
}