I have a node module which does some string comparison. I.e "if (thing == 'string')...". There are several instances of similar comparisons using predefined strings which do not change, and if so, all instances change respectively.Let's say that i store the strings in an object called "MY_CONST", and instead of the above, I do: "if (thing == MY_CONST.string)..."Is there a significant performance penalty from the dereferencing of the value in MY_CONST? Any performance penalty whatsoever? I'm just curious because MY_CONST isn't used outside of the module (a single file), but storing the strings in a variable makes the operation far more sane.
Submitted April 11, 2016 at 03:07PM by SomeRandomBuddy
No comments:
Post a Comment