40 characters really isn't very long at all. Especially considering that comparing strings means you generally don't have to check the whole string:
"b1234872938741279834712987398127398712983798123" eq "b2137298379812739812739871239871289379812739817" can be tested to be false after comparing only 2 characters, for example.
In any case, I may be able to help you optimize things, but since I suspect the performance issue is somewhere else in your code you'll have to convince me that your analysis of the problem is correct. Showing that the slowness is in any way significant will help too - It's pointless to spend half an hour speeding up a program that won't take more than a minute of CPU time in its entire useful life :)
| [reply] [d/l] |
40 characters is not very long. Thousands or millions might be considered long. Maybe the code inside the if{...} block (not the conditional itself) is the culprit? How are you measuring this? | [reply] [d/l] |