Closed Hua-Zhou closed 6 years ago
Some profiling shows the culprit might be this line
https://github.com/OpenMendel/SnpArrays.jl/blob/d878a31b7ef9d118f3113da2ac1bc1f14b0a98e4/src/SnpArrays.jl#L248
If A
is a SnpVector
, then maf
is a scalar. But if A
is a SnpMatrix
of dimension (n, 1)
, then maf
is a vector with a single element. This causes type instability. maf
is dynamically allocated at run time, causing unnecessary memory allocation
congrats
Reported by @ericsobel and @biona001.
Following code
shows suspiciously high memory allocation
Using
@views
doesn't help:yields
Converting to a matrix shows similar memory allocation:
yields
Machine information:
SnpArrays.jl version is v0.0.1 (d878a31).