I'm working on a project in which we are producing a language which compiles to java. The framework we are using (xtext) makes prolific use of boxing in its generated code. Specifically, if you have a statement like:
int i = 1;
int j = 2;
int k = i + j;
Then the compiled code looks like:
IntegerExtensions.operator_plus(((Integer)i), ((Integer)j))
Now, in the project I'm working on, there are certain situations where particular basic binary operations are going to be extremely common (especially increments and comparisons).
My question is: is this going to be a problem in terms of performance, or will JIT (or similarly intelligent JVM features) simply realize what's going on and fix it all?
PLEASE READ BEFORE POSTING: I'm not interested in getting responses saying "you shouldn't care, make it readable". This code is generated, and I simply don't care about the readability of the generated code. What I do care about is that we don't take a significant performance hit from this.
Thanks