Hey all, I have a bit of a technical optimization question with regards to the Kotlin compiler.
Are there any circumstances in which Kotlin will monomorphize generic classes? For instance, if I have a class Foo
X, my understanding is that usually on the JVM Foo
Double will require boxing of the double argument for any method using / returning the generic type parameter.
Are there any instances where Kotlin will generate a monomorphized version FooDouble behind the scenes to avoid boxing of the double result / argument?
I've heard some people say that reified generics work by monomorphizing, but I don't know if that applies to classes, and if so if it's possible to guarantee this happens in certain instances.
Background for this is I'm trying to eliminate some sources of boxing in some performance critical code of mine, where I use instantiations of my own generic classes.