Adding dynamic optimization to appendScopeData.

This avoids the JSON handling in number/string cases and avoids serializing
the argument name in all cases. It kicks in after a hundred calls with
the same argument name/type pair, meaning that the random one-off appends
won't cause a new function to be generated but repeated ones will get
optimized.