groostav
11/10/2021, 11:05 PMpublic class DoubleArrayList(): AbstractList<Double> {
public operator fun get(index: Int): Double //I want the signature (I)D.
// I do NOT want the signature (I)Ljava/lang/Double;
}
?
I cant help but feel like with all the sophistication of inline classes, kotlins type unification and etc, I could finally have a List<Double>
that doesnt do an enormous amount of boxing/unboxing.
Like, why not generate a function get()
that's (I)Lj/l/Double;
and a function get_$D()
that's (I)D
, and where the compiler can be certain ahead of time that we're calling DoubleArrayList's get
, it generates code for`get_$D` instead of get()
?
Again, I know theres a good reason, im just curious.
I'm doing some profiling of my app right now, which itself delegates most work to some (fairly recent) fortran code, but it does have some hot loops on the VM, and most are related to poor performance of Map<String, Double>
and List<Double>
Some of those are architectural but, it would be nice if i could flip a kind of switch to say "stop using Double[]
as your backing data types and start using double[]
" to see how that helps performancegroostav
11/10/2021, 11:06 PMephemient
11/11/2021, 12:45 AM"stop usingas your backing types and start using `double[]`"Double[]
you can do that yourself
ephemient
11/11/2021, 12:49 AMgroostav
11/11/2021, 5:00 AMgroostav
11/11/2021, 5:01 AMgroostav
11/11/2021, 5:01 AMephemient
11/11/2021, 5:08 AMephemient
11/11/2021, 5:12 AMephemient
11/11/2021, 5:13 AMclass DoubleArrayList /* no mention of List<Double> at all */ {
operator fun get(index: Int): Double // etc.
}
jimn
11/12/2021, 12:31 AMephemient
11/12/2021, 12:47 AMjimn
11/12/2021, 1:37 AMjimn
11/12/2021, 1:40 AMephemient
11/12/2021, 1:50 AMjimn
11/12/2021, 1:58 AMjimn
11/12/2021, 2:15 AM