A good catch on
last in Crystal. This can be fixed by
last = a.en . I agree Julia typing helps here, though in general I more like the Crystal way: I don’t need to watch out type mismatches to avoid silent performance bugs.
Does Julia natively support static arrays or do I have to use StaticArray.jl? I am hesitant to add a large library just for 60 lines of code especially given that Julia is slow on compilation.
In C++, resizing an allocated vector to 0 reserves its original capacity. I am expecting this behavior when calling
resize!(b, 0) . If this is true, I don’t think the performance is affected much given that array
b is most often preallocated.
Anyway, if you can improve the performance of bedcov, send me a PR. I prefer not to use an external library, but if doing that helps a lot, I can accept.
EDIT: deleted the old post which is not replying to @ChenNingCong.