Creating an object has overhead (or, according to other comments, it seems that when creating an object, the cycle cannot be optimized, because nothing is done inside it).
int = int * int
No objects.
int = Integer * int or int = int * Integer
The Integer int member is multiplied by int, and no objects need to be created.
Integer = int * int
An Integer object must be created from the result (slow).
Integer = Integer * Integer
The two Integer int elements are multiplied, but then the Integer object must be created from the result (slow).
source
share