Using large NTuples makes Julia hang

@Sukera , @cjdoris , @simeonschaub , thanks a lot for your answers and sorry to answer only today! (I was away in the week-end.)

I learned a lot from your answers, and I think that I will go with @Sukera 's solution, as it lets me to keep most of my code unchanged.

Sorry to have misunderstood your idea, @cjdoris , I believed you were suggesting me to use existing primitive types rather than defining one on my own. (I was induced to believe this also because of the big warning in the documentation.)

However, I second @simeonschaub 's wish to have some way to specify padding in Julia structures: this would improve a lot the user’s experience. But I fail to imagine a nice syntax for this…

Sorry for bothering you all again, but I haven’t heard of any rejections or confirmations of the claim that NTuple and StaticVector behave differently as mentioned here.

I haven’t checked, but my guess would be the difference stems from constant propagation handling it differently for some reason and the benchmark running in a function itself. Note that Benchmarks 2,3 and 4 are more or less the same, while the big difference is in compilation of @time Foo[data] (which imo isn’t surprising, since StaticArrays has heavily optimized those cases of compilation time already).

1 Like