   [C++] Lesser of two evils: Dynamic Memory or String Comparisons?
  I have two approaches to interpret scripting language commands. I don't like either, but circumstance dictates these are my two options. I do not know which of these is less evil.#1: Read the script in preprocess and allocate objects that represent parsed commands. (Virtual methods, dynamic memory with small objects)#2: Search my keyword list, parse params and execute every command as I get to them. (Up to 15 string comparisons per command, plus parsing)
  Evil is relative.Do whatever seems like it'd be easiest to implement. If your scripting system is genuinely so performance-critical that you can't afford to do some string compares, or can't tolerate the (trivial) cost of a couple of dynamic dispatch calls and memory allocations, then you should probably be working with a VM-based system anyways.   ;  Agreed -- You've begun with a false dichotomy, ignoring IL-based (Virtual Machine) solutions.You're also worrying too much prematurely -- Common scripting solutions used across many industries are less performance than native code by an order of magnitude or more, and yet are used extensively, even in soft real-time systems like video games.I all but guarantee you that scripting will not be your bottleneck.   ;  Thanks guys. I'll just pick something.   