E
_eddie
Is there a good way to code a switch/case-type construct for maximal
speed? The goal is to parse text key/value pairs.
IOW:
// key = "Text of some kind" // value = "Value Text"
string target1;
string target2;
switch (key) {
case "Text of some kind":
target1 = value;
break;
case "Text of some other kind":
target2 = value;
break;
// etc.
The list of possible cases is long, and I would like to avoid a linear
search through all possible cases. I can't just use a hash table
cause each case statement refers to a different target loc for storing
the 'value' part.
Any ideas?
speed? The goal is to parse text key/value pairs.
IOW:
// key = "Text of some kind" // value = "Value Text"
string target1;
string target2;
switch (key) {
case "Text of some kind":
target1 = value;
break;
case "Text of some other kind":
target2 = value;
break;
// etc.
The list of possible cases is long, and I would like to avoid a linear
search through all possible cases. I can't just use a hash table
cause each case statement refers to a different target loc for storing
the 'value' part.
Any ideas?