#yes. You can eliminate the first array
1 messages · Page 1 of 1 (latest)
That would involve pulling those definitions out from within the method, correct? Basically, what I want is for each line of the switch statement to contain the relevant potential outcomes (which are constant)
yes. Are you calling this in an update loop? I would leave this as an optimization for later personally
yeah, exactly
Hmm, on that note, how do people typically indicate that something is to be optimized later? Do you just throw around a bunch of TODOs?
that's one way, but I would be using the profiler and using it to guide me to find the things spewing garbage or taking too long
okok, thanks
Actually, I sat on this more, and I think I can convert my switch statement to a dictionary. The only problem is - are there any dictionary implementations that support pattern matching? e.g.
dict[(A, A)] = 1;
dict[(A, B)] = 1;
dict[(B, _)] = -1;
What you have directly written there, no not really. You can certainly use a tuple as a key as in the first two rows here but the third row thing with the discard _ would not work.
You'd have to build a system like that yourself.