Using hcat with splatting on arrays of different lengths kills Julia

Use reduce(hcat, X) instead, which calls an efficient specialized method. In general one should avoid splatting collections whose number of elements can vary a lot, since as you noted it triggers a lot of compilation.