Performance improvements to generated java code (especially for equality comparisons and copying)